Skip to content

Fix geocml-server so it picks up changes from geocml-project.qgz #72

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfiles/Dockerfile.geocml-server
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM ubuntu:22.04

USER root

RUN apt update

# Install QGIS Server
Expand All @@ -12,6 +14,7 @@ RUN apt install -y apache2 libapache2-mod-wsgi-py3 libapache2-mod-fcgid
COPY ./build-resources/geocml-server/geocml.server.conf /etc/apache2/sites-available/geocml.server.conf

# Enable geocml.server and Apache
# TODO: this should be in the Ansible playbook
RUN a2ensite geocml.server

# Install Ansible
Expand Down
10 changes: 1 addition & 9 deletions ansible-playbooks/geocml-server-playbook.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- # Configure apache2
- # Configure geocml-server
hosts: localhost
connection: local
gather_facts: yes
Expand All @@ -15,11 +15,3 @@
state: present
name: fcgid
force: true
- name: Make QGIS Server log dir
ansible.builtin.command: mkdir -p /var/log/qgis/
- name: Change QGIS Server log dir's owner to www-data
ansible.builtin.command: chown www-data:www-data /var/log/qgis
- name: Make qgisserverdb dir
ansible.builtin.command: mkdir -p /home/qgis/qgisserverdb
- name: Change qgisserverdb dir's owner to www-data
ansible.builtin.command: chown www-data:www-data /home/qgis/qgisserverdb
21 changes: 2 additions & 19 deletions build-resources/geocml-server/geocml.server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,21 @@ WSGIPythonPath /var/www/html

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName geocml.server
ServerName geocml.server

DocumentRoot /var/www/html

# Apache logs (different than QGIS Server log)
ErrorLog ${APACHE_LOG_DIR}/geocml.server.error.log
CustomLog ${APACHE_LOG_DIR}/geocml.server.access.log combined

# Longer timeout for WPS... default = 40
FcgidIOTimeout 120

FcgidInitialEnv LC_ALL "en_US.UTF-8"
FcgidInitialEnv PYTHONIOENCODING UTF-8
FcgidInitialEnv LANG "en_US.UTF-8"

# QGIS log
FcgidInitialEnv QGIS_SERVER_LOG_STDERR 1
FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0

# default QGIS project
SetEnv QGIS_PROJECT_FILE /Persistence/geocml-project.qgz

# QGIS_AUTH_DB_DIR_PATH must lead to a directory writeable by the Server's FCGI process user
FcgidInitialEnv QGIS_AUTH_DB_DIR_PATH "/home/qgis/qgisserverdb/"
FcgidInitialEnv QGIS_AUTH_PASSWORD_FILE "/home/qgis/qgisserverdb/qgis-auth.db"

# Set pg access via pg_service file
SetEnv PGSERVICEFILE /home/qgis/.pg_service.conf
FcgidInitialEnv PGPASSFILE "/home/qgis/.pgpass"
SetEnv QGIS_PROJECT_FILE /usr/lib/cgi-bin/geocml-project.qgz

# if qgis-server is installed from packages in debian based distros this is usually /usr/lib/cgi-bin/
# run "locate qgis_mapserv.fcgi" if you don't know where qgis_mapserv.fcgi is
ScriptAlias "/cgi-bin/" "/usr/lib/cgi-bin/"
<Directory "/usr/lib/cgi-bin/">
AllowOverride None
Expand Down
8 changes: 4 additions & 4 deletions build-resources/geocml-server/portal/portal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ def get_status(service):
try:
res = os.system('ping {} -c 2'.format(service))
if res == 0:
return True
return True
else:
return False
except RuntimeError as e:
logger.warning(e)
logger.warning(e)
return False

def get_vnc_connection_details_as_yaml(request):
return """
url: {}:5901
url: {}:5901
""".format(request.get_host())

def get_postgres_connection_details_as_yaml():
return """
host: geocml-postgres
port: 5432
database: geocml_db
database: geocml_db
"""

def index(request):
Expand Down
3 changes: 2 additions & 1 deletion build-resources/geocml-server/start-geocml-server.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ln -s /Persistence/geocml-project.qgz /usr/lib/cgi-bin/geocml-project.qgz
service apache2 start
cd /var/www/html/ && python3 manage.py makemigrations
cd /var/www/html/ && python3 manage.py migrate
cd /var/www/html/ && python3 manage.py collectstatic --noinput
cd /var/www/html/ && python3 manage.py runserver --verbosity 3
cd /var/www/html/ && python3 manage.py runserver --verbosity 3
Loading