Commit 572795a8 by source_reader

updated timescale and apache configs

parent f0f01935
......@@ -31,8 +31,7 @@ class joule {
path => ['/usr/local/bin','/usr/sbin','/bin'],
creates => '/etc/joule/main.conf',
require => Exec['install_joule',
'initialize_timescale',
'initialize_schemas']
'custom_sql']
}
user{'joule':
ensure => present,
......@@ -52,6 +51,7 @@ class joule {
user => 'joule',
password=> postgresql_password('joule','joule'),
}
postgresql::server::grant_role { 'joule':
group => 'pg_read_all_settings',
ensure => 'present',
......@@ -64,21 +64,57 @@ class joule {
CREATE SCHEMA metadata;
GRANT ALL PRIVILEGES ON data TO joule;
GRANT ALL PRIVILEGES ON metadata TO joule;
GRANT ALL PRIVILEGES ON DATABASE joule TO joule WITH GRANT OPTION;
ALTER ROLE joule WITH CREATEROLE;
ALTER ROLE joule WITH REPLICATION;
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
| EOT
exec { 'initialize_schemas':
exec { 'custom_sql':
command => "echo '${sql_cmd}' | psql",
user => 'joule',
path => ['/usr/local/pgsql/bin','/usr/bin:/bin'],
require => Postgresql::Server::Db['joule']
}
$sql_timescale = 'CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;'
exec { 'initialize_timescale':
command => "psql joule -c '$sql_timescale'",
user => 'postgres',
path => ['/usr/local/pgsql/bin','/usr/bin:/bin'],
require => Postgresql::Server::Db['joule']
}
}
postgresql::server::pg_hba_rule { 'allow remote access for modules':
description => 'allow network access to joule database',
type => 'host',
database => 'joule',
user => 'joule_module',
address => '0.0.0.0/0',
auth_method => 'md5',
}
postgresql::server::pg_hba_rule { 'allow local access for joule daemon ipv4':
description => 'allow network access to joule database',
type => 'host',
database => 'joule',
user => 'joule',
address => '127.0.0.1/32',
auth_method => 'md5',
}
postgresql::server::pg_hba_rule { 'allow local access for joule daemon ipv6':
description => 'allow network access to joule database',
type => 'host',
database => 'joule',
user => 'joule',
address => '::1/128',
auth_method => 'md5',
}
postgresql::server::pg_hba_rule { 'allow local replication for joule daemon ipv4':
description => 'allow network access to joule database',
type => 'host',
database => 'replication',
user => 'joule',
address => '127.0.0.1/32',
auth_method => 'md5',
}
postgresql::server::pg_hba_rule { 'allow local replication for joule daemon ipv6':
description => 'allow network access to joule database',
type => 'host',
database => 'replication',
user => 'joule',
address => '::1/128',
auth_method => 'md5',
}
}
ServerName wattsworth.localhost
<VirtualHost *:80>
PassengerMaxPoolSize 1
PassengerMinInstances 1
DocumentRoot /var/www/frontend
Alias /api /opt/api/public
<Directory /opt/api/public>
......
......@@ -27,6 +27,13 @@ class static_sites {
path => ['/bin', '/usr/sbin', '/usr/bin'],
require => File['/var/www/frontend']
}
file{'/etc/apache2/conf-enabled/passenger_prestart.conf;:
source => 'puppet:///modules/static_sites/passenger_prestart.conf',
owner => root,
group => root,
mode => '0644',
}
file{'/etc/apache2/sites-available/10-combined.conf':
source => 'puppet:///modules/static_sites/10-combined.conf',
......
# Class: timescaledb
# ===========================
#
# Full description of class timescaledb here.
#
# Authors
# -------
#
# John Donnal
#
#
class timescaledb {
if $facts['platform'] == 'ubuntu' {
apt::source { 'postgresql':
location => 'http://apt.postgresql.org/pub/repos/apt/',
release => "${lsbdistcodename}-pgdg",
repos => 'main',
key => {
'id' => 'B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8',
'server' => 'hkp://p80.pool.sks-keyservers.net:80'
}
}
apt::ppa {'ppa:timescale/timescaledb-ppa': }
package {'timescaledb-postgresql-10':
ensure => 'present',
require => [Apt::Source['postgresql'], Apt::Ppa['ppa:timescale/timescaledb-ppa']]
}
class{ 'postgresql::server':
}
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 => '11',
# 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',
}
}
}
# Class: timescaledb
# ===========================
#
......@@ -35,22 +36,22 @@ class 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',
# bindir => '/usr/local/pgsql/bin',
# confdir => '/var/lib/postgresql/10/main',
# datadir => '/var/lib/postgresql/10/main',
version => '11',
# 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',
# 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',
# psql_path => '/usr/local/pgsql/bin/psql',
#
}
postgresql::server::config_entry { 'shared_preload_libraries':
......
......@@ -5,12 +5,26 @@ set -e
# sudo systemd-nspawn -D squashfs-root/ -b --network-interface=enxd8eb97bdd8ed --bind-ro=/home/jdonnal/puppet:/home/ubuntu/puppet -M wattsworth
#use UMD servers
cat > /etc/apt/sources.list <<EOF
deb http://mirror.umd.edu/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirror.umd.edu/raspbian/raspbian/ stretch main contrib non-free rpi
EOF
#cat > /etc/apt/sources.list <<EOF
#deb http://mirror.umd.edu/raspbian/raspbian/ stretch main contrib non-free rpi
#deb-src http://mirror.umd.edu/raspbian/raspbian/ stretch main contrib non-free rpi
#EOF
#echo "nameserver 172.31.33.1" > /etc/resolv.conf
apt-get update
apt-get upgrade -y
apt install puppet git r10k -y
# install postgres and timescale
apt install postgres libpq-dev postgresql-server-dev-11 libssl-dev clang-format
git clone https://github.com/timescale/timescaledb.git
cd timescaledb
git checkout 1.4.0
echo "installing timescale version 1.4.0"
./bootstrap
cd build && make
make install
# upgraade pip
pip3 install --upgrade pip
......@@ -19,7 +19,8 @@ node 'nilm'{
node 'rpi'{
include joule
include timescaledb
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