Commit ab8c3791 by source_reader

added raspberry pi support

parent f50de7c5
......@@ -3,3 +3,5 @@ docs/_build/*
.DS_Store
forge_modules/
*.idea
exodriver-master
master.zip
\ No newline at end of file
......@@ -40,3 +40,32 @@ cp /usr/bin/qemu-arm-static mnt/usr/bin
4.) spawn a container:
systemd-nspawn -D mnt -b --network-interface enxd8eb97bdd8ed --bind /home/jdonnal/puppet:/home/pi/puppet -b --network-interface=enxd8eb97bdd8ed --bind /media/jdonnal/wattsworth_tests:/home/pi/tests -M rpi
#### Install on the Raspberry Pi Directly ####
1.) Update apt sources:
Use mirror at http://mirror.umd.edu/raspbian/raspbian
2.) Increase swap to 2G:
add CONF_SWAPFACTOR=4 to /etc/dphys-swapfile
reboot
free -h
2.) Install Python 3.6
$ wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
$ sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
tar xf ..
./configure --enable-optimizations
make
make install
3.) Install Numpy and Scipy
sudo apt install libatlas-base-dev
sudo apt build-dep python3 numpy scipy
get the numpy zip file from pypi
4.) Compile Postgresql 10.7 with systemd support and add service file from https://www.postgresql.org/docs/10/server-start.html
5.) Compile timescaledb from source
6.) Install passenger as gem and then run passenger-install-apache2-module (something like that :) )
\ No newline at end of file
......@@ -7,5 +7,6 @@ mkdir -p forge_modules
r10k puppetfile install --moduledir=./forge_modules
# run puppet
export FACTER_PLATFORM="ubuntu"
/opt/puppetlabs/bin/puppet apply --verbose --modulepath=./forge_modules:./modules site.pp
......@@ -11,20 +11,15 @@ class apache {
#configure passenger for host rails applications
exec{ 'install-keys':
command => '/usr/bin/apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7',
require => Package[$deps],
}
package {$https_pkgs:
ensure => present,
require => Exec['install-keys'],
notify => Exec['add-repo']
}
exec {'add-repo':
command => "/bin/sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list' && /usr/bin/apt-get update",
refreshonly => true
}
if $facts['platform'] == 'ubuntu' {
exec{ 'install-keys':
command => '/usr/bin/apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7',
require => Package[$deps],
}
exec {'add-repo':
command => "/bin/sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list' && /usr/bin/apt-get update",
refreshonly => true
}
package{'libapache2-mod-passenger':
ensure => present,
......@@ -38,6 +33,25 @@ class apache {
refreshonly => true,
notify => Exec['apache2ctl restart']
}
} else {
exec{ 'install-keys':
command => '/bin/true',
require => Package[$deps],
}
exec {'add-repo':
command => '/bin/true',
refreshonly => true
}
notice("omitting passenger key and repository on rpi platform")
}
package {$https_pkgs:
ensure => present,
require => Exec['install-keys'],
notify => Exec['add-repo']
}
file { '/etc/apache2/sites-enabled/000-default.conf':
ensure => absent,
notify => Exec['apache2ctl restart']
......
......@@ -67,7 +67,7 @@ class joule {
exec { 'initialize_schemas':
command => "echo '${sql_cmd}' | psql",
user => 'joule',
path => ['/usr/bin:/bin'],
path => ['/usr/local/pgsql/bin','/usr/bin:/bin'],
require => Postgresql::Server::Db['joule']
}
......@@ -75,7 +75,7 @@ class joule {
exec { 'initialize_timescale':
command => "psql joule -c '$sql_timescale'",
user => 'postgres',
path => ['/usr/bin:/bin'],
path => ['/usr/local/pgsql/bin','/usr/bin:/bin'],
require => Postgresql::Server::Db['joule']
}
......
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
#require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
......@@ -39,7 +39,17 @@ class rails_api {
mode => '0644',
require => Vcsrepo['/opt/api']
}
# remove bootsnap because it crashes on RPi's
if $facts['platform'] == 'rpi' {
file {'/opt/api/config/boot.rb':
source => 'puppet:///modules/rails_api/boot.rb',
owner => 'rails',
group => 'rails',
mode => '0644',
require => Vcsrepo['/opt/api'],
notify => Exec['db_migrate']
}
}
postgresql::server::db { 'rails':
user => 'rails',
password=> postgresql_password('rails','rails'),
......
......@@ -11,6 +11,7 @@
#
class timescaledb {
if $facts['platform'] == 'ubuntu' {
apt::source { 'postgresql':
location => 'http://apt.postgresql.org/pub/repos/apt/',
......@@ -32,6 +33,29 @@ class timescaledb {
postgresql::server::config_entry { 'shared_preload_libraries':
value => 'timescaledb',
}
} else {
class{ 'postgresql::globals':
bindir => '/usr/local/pgsql/bin',
confdir => '/var/lib/postgresql/10/main',
datadir => '/var/lib/postgresql/10/main',
version => '10.7',
service_name => 'postgresql',
client_package_name => 'postgresql-9.6',
psql_path => '/usr/local/pgsql/bin/psql',
}
class{ 'postgresql::server':
# createdb_path => '/usr/local/pgsql/bin/createdb',
# initdb_path => '/usr/local/pgsql/bin/initdb',
package_ensure => 'absent',
# pg_hba_conf_path => '/var/lib/postgresql/10/main/pg_hba.conf',
# pg_ident_conf_path => '/var/lib/postgresql/10/main/pg_ident.conf',
# postgresql_conf_path => '/var/lib/postgresql/10/main/postgresq.conf',
psql_path => '/usr/local/pgsql/bin/psql',
#
}
postgresql::server::config_entry { 'shared_preload_libraries':
value => 'timescaledb',
}
}
}
#!/bin/bash
source set_locale.sh
# install the puppet forge modules
mkdir -p forge_modules
r10k puppetfile install --moduledir=./forge_modules
# run puppet
export FACTER_PLATFORM="rpi"
puppet apply --verbose --debug --modulepath=./forge_modules:./modules site.pp
#!/bin/bash
set -e
# start a container with the following command:
# sudo systemd-nspawn -D squashfs-root/ -b --network-interface=enxd8eb97bdd8ed --bind-ro=/home/jdonnal/puppet:/home/ubuntu/puppet -M wattsworth
#echo "nameserver 172.31.33.1" > /etc/resolv.conf
apt-get update
apt-get upgrade -y
apt install puppet git r10k -y
......@@ -16,3 +16,10 @@ node 'nilm'{
include joule_labjack
include nilmplug
}
node 'rpi'{
include joule
include static_sites
include rails_api
include joule_labjack
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment