Commit 265af181c5f0920649b5a6b7524ac0632ecf941a

Authored by hitier
1 parent 5533319e
Exists in rhitier-dev

Set Docker compose structure

.dockerignore 0 → 100644
@@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
  1 +bin
  2 +cache
  3 +CHANGELOG.md
  4 +DEV.md
  5 +docker-compose.yml
  6 +Dockerfile
  7 +.dockerignore
  8 +.git
  9 +.gitignore
  10 +.gitlab-ci.yml
  11 +heliopropa.wsgi
  12 +.idea
  13 +LICENSE
  14 +__pycache__
  15 +pytest.ini
  16 +README.md
  17 +requirements-dev.txt
  18 +requirements-stable.txt
  19 +requirements-tests.txt
  20 +resources
  21 +resources-tests
  22 +SPACEWEATHERONLINE.md
  23 +spec
  24 +tests
  25 +TODO.md
  26 +venv
  27 +VISITS
Dockerfile 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +FROM python:3.9-slim-bullseye
  2 +
  3 +ENV VIRTUAL_ENV=/opt/venv
  4 +RUN python3 -m venv $VIRTUAL_ENV
  5 +ENV PATH="$VIRTUAL_ENV/bin:$PATH"
  6 +
  7 +# Install dependencies:
  8 +COPY requirements.txt .
  9 +
  10 +RUN pip install --upgrade pip &&\
  11 + pip install wheel &&\
  12 + pip install -r requirements.txt
  13 +
  14 +# Build the whole stuff
  15 +COPY . .
  16 +
  17 +# Allow running outside compose
  18 +CMD flask --app heliopropa:application run --host=0.0.0.0
0 \ No newline at end of file 19 \ No newline at end of file
@@ -15,6 +15,10 @@ It also gathers NetCDF data from AMDA, and serves it as CSV to the plotter. @@ -15,6 +15,10 @@ It also gathers NetCDF data from AMDA, and serves it as CSV to the plotter.
15 - `web/view/home.html.jinja2` : the HTML template. 15 - `web/view/home.html.jinja2` : the HTML template.
16 - `web/static/js/swapp.ls` : most of the javascript client-side. 16 - `web/static/js/swapp.ls` : most of the javascript client-side.
17 17
  18 +## Quick Start
  19 +
  20 + docker compose build
  21 + docker compose up
18 22
19 ### Python venv 23 ### Python venv
20 24
docker-compose.yml 0 → 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +version: '3.3'
  2 +
  3 +services:
  4 + web:
  5 + build:
  6 + context: .
  7 + dockerfile: Dockerfile
  8 + command: gunicorn --bind 0.0.0.0:5000 heliopropa:application
  9 + volumes:
  10 + - helio_cache:/cache:rw
  11 + expose:
  12 + - 5000
  13 + nginx:
  14 + image: nginx
  15 + volumes:
  16 + - ./resources/heliopropa.nginx.docker:/etc/nginx/conf.d/default.conf
  17 + ports:
  18 + - "8080:80"
  19 + depends_on:
  20 + - web
  21 +
  22 +volumes:
  23 + helio_cache:
heliopropa.py 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +# simply use application already set in main app file
  2 +#
  3 +from web.run import app as application
resources/heliopropa.nginx.docker 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +upstream heliopropa {
  2 + server web:5000;
  3 +}
  4 +
  5 +server {
  6 +
  7 + listen 80;
  8 +
  9 + location / {
  10 + proxy_pass http://heliopropa;
  11 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  12 + proxy_set_header Host $host;
  13 + proxy_redirect off;
  14 + proxy_read_timeout 600;
  15 + proxy_connect_timeout 600;
  16 + proxy_send_timeout 600;
  17 + }
  18 +
  19 +}
resources/web_nginx.docker.conf 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +upstream hello_flask {
  2 + server web:5000;
  3 +}
  4 +
  5 +server {
  6 +
  7 + listen 80;
  8 +
  9 + location / {
  10 + proxy_pass http://hello_flask;
  11 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  12 + proxy_set_header Host $host;
  13 + proxy_redirect off;
  14 + proxy_read_timeout 600;
  15 + proxy_connect_timeout 600;
  16 + proxy_send_timeout 600;
  17 + }
  18 +
  19 +}