Commit 9bd6e1a2 by source_reader

updating jupyter setup, added wireguard, common ML python tools, and sudoer…

updating jupyter setup, added wireguard, common ML python tools, and sudoer rights for joule to control jouled
parent 9a73c107
...@@ -4,3 +4,4 @@ mod 'puppetlabs-translate', '1.2.0' ...@@ -4,3 +4,4 @@ mod 'puppetlabs-translate', '1.2.0'
mod 'puppetlabs-concat', '5.2.0' mod 'puppetlabs-concat', '5.2.0'
mod 'puppetlabs-stdlib', '5.1.0' mod 'puppetlabs-stdlib', '5.1.0'
mod 'puppetlabs-vcsrepo', '3.0.0' mod 'puppetlabs-vcsrepo', '3.0.0'
mod 'saz-sudo', '6.0.0'
...@@ -6,13 +6,15 @@ if [[ $# == 0 ]]; then ...@@ -6,13 +6,15 @@ if [[ $# == 0 ]]; then
IMAGE_TYPE='default' IMAGE_TYPE='default'
elif [[ $1 = "--nilm" ]]; then elif [[ $1 = "--nilm" ]]; then
echo "BUILDING NILM IMAGE" echo "BUILDING NILM IMAGE"
apt remove --purge libreoffice-* -y
IMAGE_TYPE='nilm' IMAGE_TYPE='nilm'
else else
echo "Error, unknown type $1" echo "Error, unknown type $1"
exit 1 exit 1
fi fi
# install the puppet forge modules # install the puppet forge modules
mkdir -p forge_modules mkdir -p forge_modules
r10k puppetfile install --moduledir=./forge_modules r10k puppetfile install --moduledir=./forge_modules
......
...@@ -12,7 +12,9 @@ EOF ...@@ -12,7 +12,9 @@ EOF
#fi #fi
#echo "nameserver 172.31.33.1" > /etc/resolv.conf #echo "nameserver 172.31.33.1" > /etc/resolv.conf
sudo add-apt-repository ppa:wireguard/wireguard -y
apt-get update apt-get update
apt remove --purge libreoffice-* -y > /dev/null
apt-get upgrade -y apt-get upgrade -y
wget https://apt.puppetlabs.com/puppet-release-bionic.deb wget https://apt.puppetlabs.com/puppet-release-bionic.deb
dpkg -i puppet-release-bionic.deb dpkg -i puppet-release-bionic.deb
......
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
# Packages required by multiple modules # Packages required by multiple modules
# #
class common { class common {
# note: chromium for Ubuntu is a snap and cannot be installed in a container
$pkgs=['build-essential','screen','emacs','openvpn', $pkgs=['build-essential','screen','emacs','openvpn',
'nmap','wget', 'sqlite3', 'gparted', 'net-tools', 'nmap','wget', 'sqlite3', 'gparted', 'net-tools',
'openssh-server','chromium-browser','zlib1g-dev', 'openssh-server','zlib1g-dev','chromium-browser',
'imagemagick'] 'imagemagick', 'python3-sklearn', 'python3-pandas']
package { $pkgs: package { $pkgs:
ensure => present ensure => present
......
joule ALL=(ALL) NOPASSWD:/usr/sbin/service joule status
joule ALL=(ALL) NOPASSWD:/usr/sbin/service joule restart
joule ALL=(ALL) NOPASSWD:/usr/bin/systemctl status joule
joule ALL=(ALL) NOPASSWD:/usr/bin/systemctl restart joule
joule ALL=(ALL) NOPASSWD:/usr/bin/journalctl -u joule *
...@@ -83,4 +83,10 @@ class joule::config { ...@@ -83,4 +83,10 @@ class joule::config {
address => '::1/128', address => '::1/128',
auth_method => 'md5', auth_method => 'md5',
} }
#allow joule user to control the joule service (start|restart|status)
sudo::conf {'joule':
ensure => present,
source => 'puppet:///modules/joule/sudoers'
}
} }
...@@ -14,6 +14,6 @@ class joule::install{ ...@@ -14,6 +14,6 @@ class joule::install{
ensure => present, ensure => present,
uid => 901, uid => 901,
groups => 'dialout', groups => 'dialout',
system => true managehome => true
} }
} }
...@@ -4,13 +4,13 @@ After = syslog.target ...@@ -4,13 +4,13 @@ After = syslog.target
[Service] [Service]
Type = simple Type = simple
Environment=JUPYTER_CONFIG_DIR=/etc/jupyter Environment=JUPYTER_CONFIG_DIR=/home/joule/.jupyter
ExecStart = jupyter notebook --config /etc/jupyter/config.py ExecStart = jupyter notebook --config /home/joule/.jupyter/config.py
StandardOutput = journal StandardOutput = journal
StandardError = journal StandardError = journal
Restart = always Restart = always
RestartSec = 5 RestartSec = 5
User = jupyter User = joule
[Install] [Install]
WantedBy = multi-user.target WantedBy = multi-user.target
...@@ -7,7 +7,7 @@ import subprocess ...@@ -7,7 +7,7 @@ import subprocess
from notebook.auth import passwd from notebook.auth import passwd
@click.command() @click.command()
@click.option("-c","--config",default="/etc/jupyter/config.py") @click.option("-c","--config",default="/home/joule/.jupyter/config.py")
@click.password_option() @click.password_option()
def main(config, password): def main(config, password):
if not os.path.isfile(config): if not os.path.isfile(config):
......
class jupyter::config{ class jupyter::config{
file{'/etc/jupyter': file{'/home/joule/.jupyter':
ensure => directory, ensure => directory,
recurse => true, recurse => true,
source => 'puppet:///modules/jupyter/etc', source => 'puppet:///modules/jupyter/configs',
owner => root, owner => root,
group => root, group => root,
} }
...@@ -19,8 +19,5 @@ class jupyter::config{ ...@@ -19,8 +19,5 @@ class jupyter::config{
group => root, group => root,
mode => '0755' mode => '0755'
} }
exec { 'remove jupyter Desktop':
command => '/usr/bin/rm -rf /home/jupyter/Desktop',
}
} }
...@@ -6,10 +6,4 @@ class jupyter::install{ ...@@ -6,10 +6,4 @@ class jupyter::install{
provider => pip3 provider => pip3
} }
user{'jupyter':
ensure => present,
managehome => true,
uid => 902,
}
} }
...@@ -13,11 +13,19 @@ set -e ...@@ -13,11 +13,19 @@ set -e
echo "SET LOCALE" echo "SET LOCALE"
raspi-config raspi-config
echo "deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" >> /etc/apt/sources.list
apt-get update apt get update
apt-get upgrade -y apt get upgrade -y
apt install puppet git r10k -y apt install puppet git r10k -y
# install wireguard
apt install raspberrypi-kernel-headers
git clone https://git.zx2c4.com/WireGuard
cd WireGuard/src
make install
cd -
# install postgres and timescale # install postgres and timescale
apt install postgresql libpq-dev postgresql-server-dev-11 libssl-dev clang-format cmake -y apt install postgresql libpq-dev postgresql-server-dev-11 libssl-dev clang-format cmake -y
git clone https://github.com/timescale/timescaledb.git git clone https://github.com/timescale/timescaledb.git
...@@ -28,7 +36,10 @@ echo "installing timescale version 1.4.0" ...@@ -28,7 +36,10 @@ echo "installing timescale version 1.4.0"
cd build && make cd build && make
make install make install
# install packages for scipy
apt install gfortran libatlas-base-dev python3-pybind11
apt build-dep python3-scipy
# upgraade pip # upgrade pip
pip3 install --upgrade pip pip3 install --upgrade pip
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