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
a1c1c7c0
authored
Jan 22, 2020
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
updates to nginx to support subdomain apps
parent
a9e852a8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
7 deletions
modules/docs/files/STORAGE_README
modules/nginx/files/joule.conf
modules/nginx/files/lumen.conf
modules/nginx/templates/nginx.conf.erb
site.pp
modules/docs/files/STORAGE_README
View file @
a1c1c7c0
...
...
@@ -44,4 +44,17 @@ data from persistent instllations.
6.) Confirm new data directory:
$> sudo -u postgres psql -c "show data_directory"
--------------
# Change NilmDB data directory
1.) Create the destination folder and grant the joule user write access
2.) Modify /etc/nilmdb/nilmdb.wsgi, replacing "/opt/data" with the desired path:
import nilmdb.server
application = nilmdb.server.wsgi_application("/opt/data","/nilmdb")
#change this-----^
3.) Restart NilmDB:
$> sudo service nilmdb restart
4.) Confirm the new data directory
$> nilmtool info
\ No newline at end of file
modules/nginx/files/joule.conf
View file @
a1c1c7c0
...
...
@@ -4,6 +4,8 @@
proxy_set_header
X
-
Auth
-
Required
"true"
;
proxy_http_version
1
.
1
;
proxy_buffering
off
;
proxy_request_buffering
off
;
client_max_body_size
0
;
proxy_set_header
X
-
Forwarded
-
For
$
remote_addr
;
proxy_set_header
X
-
Api
-
Port
"443"
;
proxy_set_header
X
-
Api
-
Scheme
"https"
;
...
...
@@ -34,9 +36,5 @@
proxy_set_header
X
-
App
-
Id
$
joule_proxy_id
;
proxy_set_header
X
-
Auth
-
Required
"true"
;
}
# Lumen API REMOVE?
#location /lumen/ {
# proxy_pass http://unix:/tmp/joule/api:/;
# proxy_set_header X-Auth-Required "true";
#}
modules/nginx/files/lumen.conf
View file @
a1c1c7c0
...
...
@@ -10,7 +10,11 @@
passenger_app_root
/
opt
/
api
;
passenger_document_root
/
opt
/
api
/
public
;
passenger_enabled
on
;
passenger_set_header
X
-
App
-
Base
-
Uri
"/app"
;
passenger_set_header
X
-
App
-
Server
-
Name
$
server_name
;
passenger_set_header
X
-
App
-
Server
-
Scheme
$
scheme
;
passenger_set_header
X
-
Subdomain
-
Apps
$
subdomain_apps
;
}
# Lumen reverse proxy for data apps
location
/
app
{
...
...
modules/nginx/templates/nginx.conf.erb
View file @
a1c1c7c0
...
...
@@ -19,6 +19,8 @@ http {
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# enable large uploads
client_max_body_size 0;
# server_tokens off;
# server_names_hash_bucket_size 64;
...
...
@@ -62,6 +64,7 @@ http {
include /etc/nginx/map.conf;
server{
listen 80;
set $subdomain_apps false; # set to true to enable subdomains (requires DNS)
include /etc/nginx/docs.conf;
include /etc/nginx/lumen.conf;
<%
if
@nilmdb
-%>
...
...
@@ -70,6 +73,7 @@ http {
}
server{
listen 443 ssl;
set $subdomain_apps false; # set to true to enable subdomains (requires DNS)
include /etc/nginx/lumen.conf;
include /etc/nginx/joule.conf;
<%
if
@nilmdb
==
true
-%>
...
...
@@ -77,9 +81,38 @@ http {
<%
end
-%>
# Security configuration
# ssl on;
# Note: replace these with LetsEncrypt certificates or
# similar for public facing systems. For subdomain apps
# they must be a wildcard *.app.
<yourdomain>
ssl_certificate /etc/joule/security/server.crt;
ssl_certificate_key /etc/joule/security/server.key;
}
# --- subdomain configuration for apps ---
# enable by setting $subdomain_apps in server blocks
server{
listen 443 ssl;
server_name "~^(?
<app
_id
>
\d+)\.app\.(?
<domain>
.+)$";
location / {
proxy_pass "https://127.0.0.1/app/${app_id}${uri}?${args}";
proxy_hide_header Content-Security-Policy;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
# must be a wildcard *.app.
<yourdomain>
ssl_certificate /etc/joule/security/server.crt;
ssl_certificate_key /etc/joule/security/server.key;
}
server{
listen 80;
server_name "~^(?
<app
_id
>
\d+)\.app\.(?
<domain>
.+)$";
location / {
proxy_pass "http://127.0.0.1/app/${app_id}${uri}?${args}";
proxy_hide_header Content-Security-Policy;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
site.pp
View file @
a1c1c7c0
node
'default'
{
include
common
include
timescaledb
include
rails_api
include
joule_labjack
...
...
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