Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
puppet
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
572795a8
authored
Jul 26, 2019
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
updated timescale and apache configs
parent
f0f01935
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
150 additions
and
28 deletions
modules/joule/manifests/init.pp
modules/static_sites/files/10-combined.conf
modules/static_sites/files/passenger_prestart.conf
modules/static_sites/manifests/init.pp
modules/timescaledb/manifests/#init.pp#
modules/timescaledb/manifests/init.pp
rpi_bootstrap.sh
site.pp
modules/joule/manifests/init.pp
View file @
572795a8
...
...
@@ -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'
,
}
}
modules/static_sites/files/10-combined.conf
View file @
572795a8
ServerName
wattsworth
.
localhost
<
VirtualHost
*:
80
>
PassengerMaxPoolSize
1
PassengerMinInstances
1
DocumentRoot
/
var
/
www
/
frontend
Alias
/
api
/
opt
/
api
/
public
<
Directory
/
opt
/
api
/
public
>
...
...
modules/static_sites/files/passenger_prestart.conf
0 → 100644
View file @
572795a8
PassengerPreStart
http
://
localhost
modules/static_sites/manifests/init.pp
View file @
572795a8
...
...
@@ -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
',
...
...
modules/timescaledb/manifests/#init.pp#
0 → 100644
View file @
572795a8
#
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'
,
}
}
}
modules/timescaledb/manifests/init.pp
View file @
572795a8
# 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
=>
'1
0.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
=>
'1
1
'
,
#
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'
:
...
...
rpi_bootstrap.sh
View file @
572795a8
...
...
@@ -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
site.pp
View file @
572795a8
...
...
@@ -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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment