Unify Sahana naming and nginx configuration for spotter-appmgr
This commit is contained in:
parent
71ab395bff
commit
3cf4d8ec1f
14
sahana.sh
14
sahana.sh
@ -24,12 +24,12 @@ chown -R 8001:8001 /srv/sahana/data
|
|||||||
|
|
||||||
# Configure Sahana
|
# Configure Sahana
|
||||||
export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64)
|
export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64)
|
||||||
envsubst <${SOURCE_DIR}/srv/sahana/conf/000_config.py >/srv/sahana/conf/000_config.py
|
|
||||||
cp ${SOURCE_DIR}/srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py
|
|
||||||
cp ${SOURCE_DIR}/srv/sahana/update-ip.sh /srv/sahana/update-ip.sh
|
|
||||||
export SAHANA_ADMIN_USER=admin@example.com
|
export SAHANA_ADMIN_USER=admin@example.com
|
||||||
export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||||
|
envsubst <${SOURCE_DIR}/srv/sahana/conf/000_config.py >/srv/sahana/conf/000_config.py
|
||||||
envsubst <${SOURCE_DIR}/srv/sahana/data/Spotter/masterUsers.csv >/srv/sahana/data/Spotter/masterUsers.csv
|
envsubst <${SOURCE_DIR}/srv/sahana/data/Spotter/masterUsers.csv >/srv/sahana/data/Spotter/masterUsers.csv
|
||||||
|
cp ${SOURCE_DIR}/srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py
|
||||||
|
cp ${SOURCE_DIR}/srv/sahana/update-url.sh /srv/sahana/update-url.sh
|
||||||
|
|
||||||
# Populate database
|
# Populate database
|
||||||
docker run --rm -h sahana --link postgres -v /srv/sahana/conf:/srv/web2py/applications/eden/models -v /srv/sahana/data/Spotter:/srv/web2py/applications/eden/modules/templates/Spotter -v /srv/sahana/data/databases:/srv/web2py/applications/eden/databases sahana su - sahana -c "./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py"
|
docker run --rm -h sahana --link postgres -v /srv/sahana/conf:/srv/web2py/applications/eden/models -v /srv/sahana/data/Spotter:/srv/web2py/applications/eden/modules/templates/Spotter -v /srv/sahana/data/databases:/srv/web2py/applications/eden/databases sahana su - sahana -c "./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py"
|
||||||
@ -46,9 +46,5 @@ cp ${SOURCE_DIR}/etc/init.d/sahana /etc/init.d/sahana
|
|||||||
rc-update add sahana
|
rc-update add sahana
|
||||||
service sahana start
|
service sahana start
|
||||||
|
|
||||||
# Create nginx app definition
|
# Add application definition
|
||||||
cp ${SOURCE_DIR}/etc/nginx/conf.d/sahana.conf /etc/nginx/conf.d/sahana.conf
|
spotter-appmgr add-app sahana "https://sahana.{host}/eden/" "${SAHANA_ADMIN_USER}" "${SAHANA_ADMIN_PWD}"
|
||||||
service nginx reload
|
|
||||||
|
|
||||||
# Add portal application definition
|
|
||||||
portal-app-manager sahana-eden "https://{host}:8401/eden/" "${SAHANA_ADMIN_USER}" "${SAHANA_ADMIN_PWD}"
|
|
||||||
|
@ -55,6 +55,6 @@ COPY docker/etc/ /etc/
|
|||||||
COPY --chown=8001:8001 docker/srv/ /srv/
|
COPY --chown=8001:8001 docker/srv/ /srv/
|
||||||
|
|
||||||
VOLUME ["/srv/web2py/applications/eden/models", "/srv/web2py/applications/eden/databases", "/srv/web2py/applications/eden/uploads"]
|
VOLUME ["/srv/web2py/applications/eden/models", "/srv/web2py/applications/eden/databases", "/srv/web2py/applications/eden/uploads"]
|
||||||
EXPOSE 8001
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["s6-svscan", "/etc/services.d"]
|
CMD ["s6-svscan", "/etc/services.d"]
|
||||||
|
@ -17,20 +17,13 @@ http {
|
|||||||
sendfile on;
|
sendfile on;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 8001;
|
listen 8080;
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location = / {
|
|
||||||
return 301 $http_x_forwarded_proto://$http_x_forwarded_host/eden;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /eden {
|
location /eden {
|
||||||
uwsgi_pass unix:///run/uwsgi;
|
uwsgi_pass unix:///run/uwsgi;
|
||||||
uwsgi_read_timeout 300s;
|
uwsgi_read_timeout 300s;
|
||||||
uwsgi_send_timeout 300s;
|
uwsgi_send_timeout 300s;
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_param UWSGI_SCHEME $scheme;
|
|
||||||
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* /eden/static {
|
location ~* /eden/static {
|
||||||
|
@ -7,17 +7,12 @@ depend() {
|
|||||||
use dns logger netmount postfix
|
use dns logger netmount postfix
|
||||||
}
|
}
|
||||||
|
|
||||||
start_pre() {
|
|
||||||
/srv/sahana/update-ip.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
/usr/bin/docker run -d --rm \
|
/usr/bin/docker run -d --rm \
|
||||||
--name sahana \
|
--name sahana \
|
||||||
-h sahana \
|
-h sahana \
|
||||||
--link postfix \
|
--link postfix \
|
||||||
--link postgres \
|
--link postgres \
|
||||||
-p 127.0.0.1:8001:8001 \
|
|
||||||
-v /srv/sahana/conf:/srv/web2py/applications/eden/models \
|
-v /srv/sahana/conf:/srv/web2py/applications/eden/models \
|
||||||
-v /srv/sahana/data/Spotter:/srv/web2py/applications/eden/modules/templates/Spotter \
|
-v /srv/sahana/data/Spotter:/srv/web2py/applications/eden/modules/templates/Spotter \
|
||||||
-v /srv/sahana/data/databases:/srv/web2py/applications/eden/databases \
|
-v /srv/sahana/data/databases:/srv/web2py/applications/eden/databases \
|
||||||
@ -25,6 +20,10 @@ start() {
|
|||||||
sahana
|
sahana
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_post() {
|
||||||
|
/usr/local/bin/spotter-appmgr update-hosts sahana
|
||||||
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
/usr/bin/docker stop sahana
|
/usr/bin/docker stop sahana
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
server {
|
|
||||||
listen [::]:8801 ipv6only=off;
|
|
||||||
listen [::]:8401 ssl http2 ipv6only=off;
|
|
||||||
|
|
||||||
access_log /var/log/nginx/sahana.access.log;
|
|
||||||
error_log /var/log/nginx/sahana.error.log;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:8001;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
URL=$(ip route get 1 | awk '{print $NF;exit}')
|
|
||||||
sed -i "s|^settings\.base\.public_url.*|settings.base.public_url = \"https://${URL}:8401\"|" /srv/sahana/conf/000_config.py
|
|
6
sahana/srv/sahana/update-url.sh
Normal file
6
sahana/srv/sahana/update-url.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
HOST="${1}"
|
||||||
|
[ "${2}" != "443" ] && HOST="${1}:${2}"
|
||||||
|
|
||||||
|
sed -i "s|^settings\.base\.public_url.*|settings.base.public_url = \"https://${HOST}\"|" /srv/sahana/conf/000_config.py
|
Loading…
Reference in New Issue
Block a user