Move CKAN to separate vhost (port) to resolve URL conflicts, resolves #146

This commit is contained in:
Disassembler 2017-11-22 19:18:38 +01:00
parent 4c6d39fded
commit 1c2596c949
8 changed files with 21 additions and 19 deletions

View File

@ -149,7 +149,6 @@ fi
systemctl restart postgresql systemctl restart postgresql
##### #####
# MariaDB # MariaDB
##### #####

View File

@ -91,10 +91,8 @@ cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-availabl
cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-available/ckan-datapusher.ini cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-available/ckan-datapusher.ini
ln -s /etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-enabled/ckan.ini ln -s /etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-enabled/ckan.ini
ln -s /etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-enabled/ckan-datapusher.ini ln -s /etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-enabled/ckan-datapusher.ini
cp ${SOURCE_DIR}/ckan/etc/nginx/apps-available/ckan /etc/nginx/apps-available/ckan cp ${SOURCE_DIR}/ckan/etc/nginx/sites-available/ckan /etc/nginx/sites-available/ckan
ln -s /etc/nginx/apps-available/ckan /etc/nginx/apps-enabled/ckan ln -s /etc/nginx/sites-available/ckan /etc/nginx/sites-enabled/ckan
cp ${SOURCE_DIR}/ckan/etc/nginx/sites-available/ckan-datapusher /etc/nginx/sites-available/ckan-datapusher
ln -s /etc/nginx/sites-available/ckan-datapusher /etc/nginx/sites-enabled/ckan-datapusher
# Restart services # Restart services
systemctl restart uwsgi systemctl restart uwsgi
@ -105,4 +103,4 @@ cp ${SOURCE_DIR}/ckan/srv/ckan/cron-pageviews.sh /srv/ckan/cron-pageviews.sh
cp ${SOURCE_DIR}/ckan/etc/cron.d/ckan /etc/cron.d/ckan cp ${SOURCE_DIR}/ckan/etc/cron.d/ckan /etc/cron.d/ckan
# Add portal application definition # Add portal application definition
${SOURCE_DIR}/basic/portal-app-manager.py ckan "/ckan/" "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}" ${SOURCE_DIR}/basic/portal-app-manager.py ckan "https://{host}:8003/" "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}"

View File

@ -57,7 +57,6 @@ ckan.datastore.default_fts_index_method = gist
## Site Settings ## Site Settings
ckan.site_url = http://127.0.0.1 ckan.site_url = http://127.0.0.1
ckan.root_path = /ckan/{{LANG}}
#ckan.use_pylons_response_cleanup_middleware = true #ckan.use_pylons_response_cleanup_middleware = true
## Authorization Settings ## Authorization Settings

View File

@ -11,7 +11,7 @@ NAME = 'datapusher'
SQLALCHEMY_DATABASE_URI = 'sqlite:////var/lib/ckan/datapusher-jobs.db' SQLALCHEMY_DATABASE_URI = 'sqlite:////var/lib/ckan/datapusher-jobs.db'
HOST = '0.0.0.0' HOST = '0.0.0.0'
PORT = 8003 PORT = 8004
FROM_EMAIL = 'ckan@spotter.ngo' FROM_EMAIL = 'ckan@spotter.ngo'
#ADMINS = ['yourname@example.com'] # where to send emails #ADMINS = ['yourname@example.com'] # where to send emails

View File

@ -1,8 +0,0 @@
location /ckan {
uwsgi_pass unix:///run/uwsgi/app/ckan/socket;
include uwsgi_params;
uwsgi_param SCRIPT_NAME /ckan;
access_log /var/log/nginx/ckan.access.log;
error_log /var/log/nginx/ckan.error.log;
}

View File

@ -5,6 +5,21 @@ server {
access_log /var/log/nginx/ckan.access.log; access_log /var/log/nginx/ckan.access.log;
error_log /var/log/nginx/ckan.error.log; error_log /var/log/nginx/ckan.error.log;
location / {
uwsgi_pass unix:///run/uwsgi/app/ckan/socket;
include uwsgi_params;
uwsgi_param SCRIPT_NAME '';
uwsgi_param UWSGI_SCHEME $scheme;
}
}
server {
listen 8004 ssl http2;
listen [::]:8004 ssl http2;
access_log /var/log/nginx/ckan.access.log;
error_log /var/log/nginx/ckan.error.log;
location / { location / {
uwsgi_pass unix:///run/uwsgi/app/ckan-datapusher/socket; uwsgi_pass unix:///run/uwsgi/app/ckan-datapusher/socket;
include uwsgi_params; include uwsgi_params;

View File

@ -5,6 +5,5 @@ chown-socket = www-data:www-data
chdir = /srv/ckan chdir = /srv/ckan
home = /srv/ckan home = /srv/ckan
exec-asap = /srv/ckan/update-ip.sh exec-asap = /srv/ckan/update-ip.sh
route-run = fixpathinfo:
disable-logging = true disable-logging = true
ini-paste = /etc/ckan/ckan.ini ini-paste = /etc/ckan/ckan.ini

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
IP=$(ip route get 1 | awk '{print $NF;exit}') IP=$(ip route get 1 | awk '{print $NF;exit}')
sed -i "s|^ckan\.site_url.*|ckan.site_url = https://${IP}|" /etc/ckan/ckan.ini sed -i "s|^ckan\.site_url.*|ckan.site_url = https://${IP}:8003|" /etc/ckan/ckan.ini
sed -i "s|^ckan\.datapusher\.url.*|ckan.datapusher.url = https://${IP}:8003|" /etc/ckan/ckan.ini sed -i "s|^ckan\.datapusher\.url.*|ckan.datapusher.url = https://${IP}:8004|" /etc/ckan/ckan.ini