Skip to content

Commit

Permalink
Merge pull request #85 from geoCML/portal-layers
Browse files Browse the repository at this point in the history
Modernize geoCML Server Portal, make configuration easier and seamless with QGIS WMS
  • Loading branch information
TristanDamron authored Aug 30, 2024
2 parents addfb44 + 6a48db1 commit 2f22a4c
Show file tree
Hide file tree
Showing 34 changed files with 20,138 additions and 643 deletions.
33 changes: 17 additions & 16 deletions Dockerfiles/Dockerfile.geocml-server
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:22.04

USER root

ARG DEBIAN_FRONTEND=noninteractive
RUN apt update

# Install QGIS Server
Expand All @@ -13,39 +13,40 @@ RUN apt install -y apache2 libapache2-mod-wsgi-py3 libapache2-mod-fcgid
# Copy Apache conf file to container
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
RUN apt install -y ansible

# Install Ansible dependencies and run through playbook
COPY ./ansible-playbooks/geocml-server-requirements.yaml ./ansible-playbooks/geocml-server-playbook.yaml ./
RUN ansible-galaxy collection install ansible.posix && ansible-galaxy install -r geocml-server-requirements.yaml && ansible-playbook -i,localhost geocml-server-playbook.yaml --tags "all" && rm -f ./*.yaml
# Install npm
RUN apt install -y npm

# Copy portal source to container
ADD ./build-resources/geocml-server/portal/ /var/www/html/
ADD ./build-resources/geocml-server/portal/ /portal/

# Install Python, Pip, and Django
RUN apt install -y python3 && apt install -y python3-pip && python3 -m pip install Django
# Install Node dependencies
RUN cd /portal/ && npm i

# Install required Python libraries
RUN python3 -m pip install -r /var/www/html/portal/requirements.txt
# Install Ansible dependencies and run through playbook
COPY ./ansible-playbooks/geocml-server-requirements.yaml ./ansible-playbooks/geocml-server-playbook.yaml ./
RUN ansible-galaxy collection install ansible.posix && ansible-galaxy install -r geocml-server-requirements.yaml && ansible-playbook -i,localhost geocml-server-playbook.yaml --tags "all" && rm -f ./*.yaml

######### Customize Container Here ###########
######### End Customizations ###########

# Add IPs to known host list
RUN sh -c "echo 'geocml-server geocml.server' >> /etc/hosts"``.
RUN sh -c "echo '127.0.0.1 geocml.server' >> /etc/hosts"``.
# Copy build script to /var/www/html
RUN cp -rf /portal/build/* /var/www/html/

# Copy start script
COPY ./build-resources/geocml-server/start-geocml-server.sh /start-geocml-server.sh

# Uninstall Ansible stuff
RUN rm -rf $HOME/.ansible && apt purge -y ansible*

# Uninstall npm
RUN apt purge -y npm*

# Remove build resources
RUN rm -rf /portal/

# Remove install cache
RUN apt clean autoclean && apt autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Once built, the image can be run locally using docker-compose.
- **Starting the image locally:** Run `docker-compose up -d`
- **Stopping the image locally:** Run `docker-compose down`

When running locally, the geocml-desktop can be accessed via a VNC Viewer at localhost:10000
When running locally, the geocml-desktop can be accessed via a VNC Viewer at localhost:10000 and geocml-server can be accessed via a web browser at localhost:80
10 changes: 10 additions & 0 deletions ansible-playbooks/geocml-server-playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
gather_facts: yes
become: yes
tasks:
- name: Enable geocml.server and Apache
ansible.builtin.command: a2ensite geocml.server
- name: Enable cgid
community.general.apache2_module:
state: present
Expand All @@ -15,3 +17,11 @@
state: present
name: fcgid
force: true
- name: Build geoCML Server Portal
ansible.builtin.command:
chdir: /portal/
cmd: npm run build
- name: Add IPs to known host list
shell: |
sh -c "echo 'geocml-server geocml.server' >> /etc/hosts"``.
sh -c "echo '127.0.0.1 geocml.server' >> /etc/hosts"``.
22 changes: 10 additions & 12 deletions build-resources/geocml-server/geocml.server.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
WSGIScriptAlias / /var/www/html/portal/wsgi.py
WSGIPythonPath /var/www/html

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

DocumentRoot /var/www/html
DocumentRoot /var/www/html/

FcgidIOTimeout 120

Expand All @@ -25,22 +22,23 @@ WSGIPythonPath /var/www/html
Require all granted
</Directory>

ScriptAlias "/" "/var/www/html/"
<Directory "/var/www/html/">
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
Options Indexes FollowSymLinks
Order deny,allow
Allow from all
</Directory>

Alias "/static" "/var/www/html/portal/collectstatic/"
Alias "/static/admin" "/var/www/html/portal/collectstatic/admin"
Alias "/static" "/var/www/html/static/"

<Directory "/var/www/html/portal/collectstatic/">
<Directory "/var/www/html/static/">
Options Indexes FollowSymLinks
Order deny,allow
Require all granted
</Directory>

<IfModule mod_fcgid.c>
FcgidMaxRequestLen 26214400
FcgidConnectTimeout 60
</IfModule>
</VirtualHost>
</VirtualHost>
24 changes: 24 additions & 0 deletions build-resources/geocml-server/portal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build
asset-manifest.json

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
22 changes: 0 additions & 22 deletions build-resources/geocml-server/portal/manage.py

This file was deleted.

Loading

0 comments on commit 2f22a4c

Please # to comment.