Skip to content

Commit

Permalink
Merge pull request #280 from mviewer/develop
Browse files Browse the repository at this point in the history
v4.0.1
  • Loading branch information
Gaetanbrl committed Nov 13, 2023
2 parents 2c44d61 + a192303 commit ce784ff
Show file tree
Hide file tree
Showing 37 changed files with 820 additions and 532 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ jobs:
- name: "Retag / push the docker images (not stable)"
if: github.repository == 'mviewer/mviewerstudio'
run: |
docker tag mviewer/mviewerstudio:python-latest mviewer/mviewerstudio:python-${{ steps.version.outputs.VERSION }}
docker tag mviewer/mviewerstudio:php-latest mviewer/mviewerstudio:php-${{ steps.version.outputs.VERSION }}
docker push mviewer/mviewerstudio:python-${{ steps.version.outputs.VERSION }}
docker push mviewer/mviewerstudio:php-${{ steps.version.outputs.VERSION }}
docker tag mviewer/mviewerstudio:latest mviewer/mviewerstudio:${{ steps.version.outputs.VERSION }}
docker push mviewer/mviewerstudio:${{ steps.version.outputs.VERSION }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ __pycache__/

*.egg-info/
*.egg

srv/python/build


# IDE stuff
Expand All @@ -31,3 +31,7 @@ pydocs*
# store
store/
public/

# npm
node*
package-*
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Application écrite en Javascript pour le front.
Référez-vous à la documentation pour plus d'information :

* [Documentation utilisateur](https://mviewerstudio.readthedocs.io/fr/stable/doc_user/accueil.html)
* [Documentation d'installation](https://mviewerstudio.readthedocs.io/fr/stable/doc_tech/install.html)
* [Documentation administrateur](https://mviewerstudio.readthedocs.io/fr/stable/doc_tech/config.html)
* [Documentation d'installation](https://mviewerstudio.readthedocs.io/fr/stable/doc_tech/install_python.html)
* [Documentation administrateur](https://mviewerstudio.readthedocs.io/fr/stable/doc_tech/config_front.html)
2 changes: 1 addition & 1 deletion config-php-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"app_conf": {
"studio_title": "GéoBretagne mviewer studio",
"mviewer_version": "3.9",
"mviewerstudio_version": "4",
"mviewerstudio_version": "4.0.1",
"is_php": "true",
"php": {
"upload_service": "srv/php/store.php",
Expand Down
6 changes: 3 additions & 3 deletions config-python-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"app_conf": {
"studio_title": "Mviewer Studio",
"mviewer_version": "3.9",
"mviewerstudio_version": "4",
"mviewerstudio_version": "4.0.1",
"api": "api/app",
"store_style_service": "api/style",
"mviewer_instance": "http://127.0.0.1:5051/",
"publish_url": "http://127.0.0.1:5051/?config=apps/public/{{config}}.xml",
"mviewer_instance": "/mviewer/",
"publish_url": "/mviewer/?config=apps/public/{{config}}.xml",
"conf_path_from_mviewer": "apps/store/",
"mviewer_short_url": {
"used": true,
Expand Down
74 changes: 33 additions & 41 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,53 @@
version: '3'
volumes:
apps:
mviewerstudio_config:

services:

# Select between the next 2 services the backend you want to use by
# commenting / uncommenting the 'volume' section & modify the links alias
# on the mviewer-studio service.
#
# You cannot use both backends at the same time, and you have to be wary if
# you switch from one to another, as each comes with a custom config.json
# file.
#
# If you want to switch, make sure either you modify the config.json, or
# reinitialize the docker volume.

# PHP version
mviewerstudio-php:
build:
context: .
dockerfile: docker/Dockerfile-php-backend
image: mviewer/mviewerstudio:php-latest
# volumes:
# - "apps:/var/www/html/apps"
# Reverse-proxy using nginx. Groups mviewer and mviewerstudio under respective paths
# Config can be found under ./docker/nginx/default.conf.template
www:
image: nginx
ports:
- 80:80
environment:
- NGINX_HOST=localhost
- MVIEWERSTUDIO_URL_PATH_PREFIX=mviewerstudio
volumes:
- ./docker/nginx:/etc/nginx/templates
depends_on:
- mviewerstudio
- mviewer

# Python version
mviewerstudio-python:
# Served under /${MVIEWERSTUDIO_URL_PATH_PREFIX}/ see docker/nginx/default.conf.template
mviewerstudio:
build:
context: .
dockerfile: docker/Dockerfile-python-backend
image: mviewer/mviewerstudio:python-latest
image: mviewer/mviewerstudio:latest
# ports:
# - "8000:8000"
environment:
- CONF_PATH_FROM_MVIEWER=apps/store
- CONF_PUBLISH_PATH_FROM_MVIEWER=apps/public
- DEFAULT_ORG=my_org
- EXPORT_CONF_FOLDER=/home/apprunner/apps/store
- MVIEWERSTUDIO_PUBLISH_PATH=/home/apprunner/apps/public
- MVIEWERSTUDIO_URL_PATH_PREFIX=mviewerstudio
volumes:
- "apps:/home/apprunner/apps"
- "mviewerstudio_config:/home/apprunner/mviewerstudio_backend/static/apps"
- "./docker/config-docker-python.json:/home/apprunner/mviewerstudio_backend/static/apps/config.json"
- "./config-python-sample.json:/home/apprunner/mviewerstudio_backend/static/apps/config.json"

# Served under /mviewer/ see docker/nginx/default.conf.template
mviewer:
depends_on:
- mviewerstudio
# this image is automatically built in
# the mviewer/mviewer github repository
# See https://github.com/mviewer/mviewer/pull/236
image: mviewer/mviewer
# ports:
# - "5051:80"
volumes:
- "apps:/usr/share/nginx/html/apps"
links:
- mviewerstudio-php
- mviewerstudio-python

mviewer-studio:
image: nginx:1.17.9
volumes:
- "./docker/nginx-default.conf:/etc/nginx/conf.d/default.conf"
ports:
- "8080:8080"
links:
- mviewer
# use the correct link entry below, depending on the selected
# backend
#- mviewerstudio-php:mviewerstudio
- mviewerstudio-python:mviewerstudio
#
34 changes: 23 additions & 11 deletions docker/Dockerfile-python-backend
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
FROM python:3.8-slim
FROM python:3.11-slim

#install git & studio dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libxml2-dev \
libxslt1-dev \
git \
&& rm -rf /var/lib/apt/lists/*

RUN useradd -r -m apprunner

USER apprunner

ENV HOME=/home/apprunner
ENV PATH=$HOME/.local/bin:$PATH
ENV EXPORT_CONF_FOLDER=/home/apprunner/apps/store

RUN mkdir -p /home/apprunner/apps/store
RUN chown -R apprunner:apprunner /home/apprunner/apps

WORKDIR /home/apprunner

COPY srv/python/requirements.txt .
RUN pip install --user -r requirements.txt

COPY --chown=apprunner:apprunner srv/python .
RUN pip install --user . && pip install --user gunicorn

RUN rm -rf mviewerstudio_backend/static/*
# We need to install the app so that the config is properly read (there might be something to fix on
# app-factory.py, calling app.config.from_object requires the package to be installed
RUN pip install --user -r requirements.txt && pip install --user .

VOLUME [ "/home/apprunner/apps" ]

COPY css/ mviewerstudio_backend/static/css
COPY img/ mviewerstudio_backend/static/img
COPY index.html mviewerstudio_backend/static/index.html
COPY mviewerstudio.i18n.json mviewerstudio_backend/static/mviewerstudio.i18n.json
COPY js/ mviewerstudio_backend/static/js
COPY lib/ mviewerstudio_backend/static/lib
COPY *.json mviewerstudio_backend/static/
COPY docker/config-docker-python.json mviewerstudio_backend/static/apps/config.json
COPY mviewerstudio.i18n.json mviewerstudio_backend/static/mviewerstudio.i18n.json

ENV EXPORT_CONF_FOLDER=/home/apprunner/apps/store \
CONF_PATH_FROM_MVIEWER=apps/store \
MVIEWERSTUDIO_PUBLISH_PATH=/home/apprunner/apps/public \
CONF_PUBLISH_PATH_FROM_MVIEWER=apps/public \
DEFAULT_ORG=public \
MVIEWERSTUDIO_URL_PATH_PREFIX=mviewerstudio/

# You will probably have to override this one on runtime with your custom config
COPY config-python-sample.json mviewerstudio_backend/static/apps/config.json

CMD ["gunicorn", "-w 4", "-b 0.0.0.0:8000", "mviewerstudio_backend.app:app"]
Loading

0 comments on commit ce784ff

Please sign in to comment.