Skip to content

Commit f6fe88c

Browse files
jeanmi151arnaud-morvanmki-c2c
authored
prepare for prod prof docker images and sample (#68)
* prepare for prod prof docker images and sample * rework docker-compose and add doc * Update README.md Co-authored-by: Arnaud Morvan <arnaud.morvan@camptocamp.com> * Update README.md Co-authored-by: Arnaud Morvan <arnaud.morvan@camptocamp.com> * Rework composition files (#69) * Update README.md Co-authored-by: Moritz Kirmse <61978301+mki-c2c@users.noreply.github.com> * Update README.md Co-authored-by: Moritz Kirmse <61978301+mki-c2c@users.noreply.github.com> * Update README.md Co-authored-by: Moritz Kirmse <61978301+mki-c2c@users.noreply.github.com> * correct fr mistake * make harvested false by default --------- Co-authored-by: Arnaud Morvan <arnaud.morvan@camptocamp.com> Co-authored-by: Moritz Kirmse <61978301+mki-c2c@users.noreply.github.com>
1 parent ae8811e commit f6fe88c

File tree

9 files changed

+123
-46
lines changed

9 files changed

+123
-46
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
- uses: actions/checkout@v4
1313

1414
- name: build
15-
run: docker compose build check
15+
run: docker compose -f docker-compose-dev.yml build check
1616

1717
- name: check
18-
run: docker compose run --rm check
18+
run: docker compose -f docker-compose-dev.yml run --rm check
1919

2020
- name: test
21-
run: docker compose run --rm check pytest --cov=maelstro tests/
21+
run: docker compose -f docker-compose-dev.yml run --rm check pytest --cov=maelstro tests/
2222

2323
frontend-check:
2424
runs-on: ubuntu-22.04
@@ -62,7 +62,7 @@ jobs:
6262
- uses: actions/checkout@v4
6363

6464
- name: Build
65-
run: docker compose build maelstro-back maelstro-front
65+
run: docker compose -f docker-compose-dev.yml build maelstro-back maelstro-front
6666

6767
- name: Login to Docker Hub
6868
uses: docker/login-action@v3

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,5 @@ cython_debug/
172172

173173
# Custom for this repo
174174
.envs-database
175+
docker-compose.override.yml
176+
docker-compose.yml

README.md

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,36 @@
22

33
geOrchestra Maelstro is an application which helps synchronise geonetwork and geoserver instances
44

5-
## Quick start with geOrchestra
5+
## Docker deploy
66

7-
Before starting developement you need to setup some geOrchestra configurations.
7+
### Solo quick start (without included geOrchestra composition)
8+
9+
Maelstro can be used outside geOrchestra.
10+
11+
First select the `docker-compose-solo.yml` file as current composition:
12+
13+
```bash
14+
ln -s docker-compose-solo.yml docker-compose.yml
15+
```
16+
17+
Then start the compositon:
18+
19+
```bash
20+
docker compose up
21+
```
22+
23+
Open : http://127.0.0.1:8080/maelstro/
24+
There is no authentication to access the page but if needed it can be done with basic auth in the [nginx config](./config/nginx-solo.conf) (or another way)
25+
26+
### Quick start with geOrchestra
27+
28+
First select the `docker-compose-geOrchestra.yml` file as current composition:
29+
30+
```bash
31+
ln -s docker-compose-geOrchestra.yml docker-compose.yml
32+
```
33+
34+
Before starting development you need to setup some geOrchestra configurations.
835

936
See commands documented here: [georchestra/README.md](georchestra/README.md)
1037

@@ -24,16 +51,26 @@ With credentials:
2451
- testadmin:testadmin
2552
- tmaelstro:tmaelstro
2653

27-
## Solo quick start
28-
Maelstro can be used outside geOrchestra.
54+
### Development
2955

56+
For development purpose, you may need to use `docker-compose-dev.yml` instead:
57+
58+
```bash
59+
rm -f docker-compose.yml
60+
ln -s docker-compose-dev.yml docker-compose.yml
3061
```
31-
docker compose -f docker-compose-solo.yml up
62+
63+
And maybe add overrides for debugging:
64+
65+
```bash
66+
cp docker-compose.override.sampl.yml docker-compose.override.yml
3267
```
33-
Open : http://127.0.0.1:8080/maelstro/
34-
There is no authentication to access the page but if needed it can be done with basic auth in the [nginx config](./config/nginx-solo.conf) (or another way)
3568

36-
## Frontend developement
69+
## Kubernetes deployment
70+
71+
The [helm](helm/) folder contains a helm chart which can be used to deploy the app.
72+
73+
## Frontend development
3774

3875
The folder [frontend](frontend) contains the SPA written with VueJS.
3976

@@ -50,6 +87,7 @@ The configuration is based on a YAML file containing connection information abou
5087
For dev use of the platform, there is a sample config in the backend folder: [dev_config.yaml](backend/dev_config.yaml). This config is used by default in the docker compo.
5188

5289
The file has 4 distict parts:
90+
5391
- sources
5492
- destinations
5593
- db_logging
@@ -66,6 +104,7 @@ The file has 4 distict parts:
66104
#### DB logging
67105

68106
The section db_logging contains all connection information to reach a writable postgres DB to use for writing and reading operation logs:
107+
69108
- host (default: database)
70109
- port (default: 5432)
71110
- login (default: georchestra)
@@ -81,13 +120,16 @@ Substitution of credentials (login and password) can be done for the DB configur
81120
The `transformations` section conatains a list of xsl transformations which can be applied to the xml metadata of source or destination servers.
82121

83122
Each named `transformation` item must conatain
123+
84124
- `xslt_path`: local path on the server to an xsl file in which the trasformation is defind (typically in the datadir)
85125
- `description`: Details of the transformation content to easily identify which transformation is applied
86126

87127
For each geonetwork item of the source and destination servers, a specific key is added to the configuration file:
128+
88129
- transformations: list of xslt keys to be applied to the metadata of the corresponding geonetwork server
89130

90131
If a list of transformations is defined for both the source and destination server, the copy operation is executed in the way described below:
132+
91133
- read metadata from source
92134
- apply all source transformations
93135
- apply all destination transformations
@@ -111,7 +153,6 @@ __Nota__:
111153

112154
At each level where login/password are specified, one can add the option `verify: false` to deactivate verification of HTTPS certificates. By default the HTTPS certificate must be valid, which is equivalent to `verify: true`
113155

114-
115156
#### Example
116157

117158
(see [doc_sample_config.yaml](backend/tests/doc_sample_config.yaml)):
@@ -158,23 +199,23 @@ Automatic code quality checks are implemented in the CI.
158199
The code test can be launched manually via the docker command below.
159200

160201
```bash
161-
docker compose run --rm check
202+
docker compose -f docker-compose-dev.yml run --rm check
162203
```
163204

164205
In case formatting issues are found, the code can be auto-fixed with:
165206

166207
```bash
167-
docker compose run --rm check /app/maelstro/scripts/code_fix.sh
208+
docker compose -f docker-compose-dev.yml run --rm check /app/maelstro/scripts/code_fix.sh
168209
```
169210

170211
To launch the tests locally, use the command as in github CI:
171212

172213
```bash
173-
docker compose run --rm check pytest --cov=maelstro tests/
214+
docker compose -f docker-compose-dev.yml run --rm check pytest --cov=maelstro tests/
174215
```
175216

176217
or
177218

178219
```bash
179-
docker compose run --rm check pytest --cov=maelstro --cov-report=html tests/
220+
docker compose -f docker-compose-ci.yml run --rm check pytest --cov=maelstro --cov-report=html tests/
180221
```

docker-compose-dev.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This composition add minimal development overrides over geOrchestra composition
2+
3+
include:
4+
- georchestra/geor-compose.yml
5+
- georchestra/geor-compose.override.yml
6+
7+
services:
8+
maelstro-front:
9+
extends:
10+
file: docker-compose-geOrchestra.yml
11+
service: maelstro-front
12+
build:
13+
context: ./frontend
14+
15+
maelstro-back:
16+
extends:
17+
file: docker-compose-geOrchestra.yml
18+
service: maelstro-back
19+
build:
20+
context: ./backend
21+
target: server
22+
volumes:
23+
- ./backend:/app
24+
- ./config/:/etc/maelstro/:ro
25+
environment:
26+
MAELSTRO_CONFIG: /app/dev_config.yaml
27+
DEBUG: true
28+
ports:
29+
- 8000:8000 # Used for frontend development
30+
31+
check:
32+
profiles:
33+
- check
34+
build:
35+
context: ./backend
36+
target: check
37+
environment:
38+
MAELSTRO_CONFIG: /app/tests/test_config.yaml
39+
LOCAL_LOGIN: testadmin
40+
LOCAL_PASSWORD: testadmin
41+
volumes:
42+
- ./backend:/app

docker-compose.yml renamed to docker-compose-geOrchestra.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This is an example of production ready composition for geOrchestra
2+
13
include:
24
- georchestra/geor-compose.yml
35
- georchestra/geor-compose.override.yml
@@ -22,13 +24,12 @@ services:
2224
file: docker-compose-solo.yml
2325
service: maelstro-back
2426
volumes:
25-
- ./backend:/app
2627
- georchestra_datadir:/etc/georchestra
2728
depends_on:
2829
envsubst:
2930
condition: service_completed_successfully
3031
environment:
31-
MAELSTRO_CONFIG: /app/dev_config.yaml
32+
MAELSTRO_CONFIG: /etc/georchestra/maelstro/config.yaml
3233
DEMO_LOGIN: testadmin
3334
DEMO_PASSWORD: testadmin
3435
LOCAL_LOGIN: testadmin
@@ -38,8 +39,3 @@ services:
3839
PGDATABASE: "georchestra"
3940
PGUSER: "georchestra"
4041
PGPASSWORD: "georchestra"
41-
42-
check:
43-
extends:
44-
file: docker-compose-solo.yml
45-
service: check

docker-compose-solo.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# This is an example of production ready standalone composition (without included geOrchestra)
12

23
volumes:
3-
postgresql_data:
4+
postgresql_data:
45

56
services:
67
database:
@@ -14,8 +15,7 @@ services:
1415
restart: no
1516

1617
maelstro-front:
17-
build:
18-
context: ./frontend
18+
image: georchestra/maelstro-frontend:latest
1919
healthcheck:
2020
test: ["CMD", "curl", "-f", "http://localhost:8080/maelstro/"]
2121
interval: 10s
@@ -30,17 +30,14 @@ services:
3030
- "8080:8080"
3131

3232
maelstro-back:
33-
build:
34-
context: ./backend
35-
target: server
33+
image: georchestra/maelstro-backend:latest
3634
healthcheck:
3735
test: "health_check"
3836
interval: 10s
3937
retries: 5
4038
start_period: 10s
4139
timeout: 10s
4240
volumes:
43-
- ./backend:/app
4441
- ./config/:/etc/maelstro/:ro
4542
env_file:
4643
- .envs-database
@@ -51,16 +48,3 @@ services:
5148
DEMO_CRD: "test12"
5249
command:
5350
- serve_docker_dev
54-
55-
check:
56-
profiles:
57-
- check
58-
build:
59-
context: ./backend
60-
target: check
61-
environment:
62-
MAELSTRO_CONFIG: /app/tests/test_config.yaml
63-
LOCAL_LOGIN: testadmin
64-
LOCAL_PASSWORD: testadmin
65-
volumes:
66-
- ./backend:/app

docker-compose.override.sample.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Here are example of some overrides for debugging
2+
3+
services:
4+
maelstro-back:
5+
{}
6+
# For debugging with VS Code
7+
# command: >
8+
# python -m debugpy --listen 0.0.0.0:5678
9+
# /usr/local/bin/fastapi dev --host 0.0.0.0 --port 8000 --reload
10+
# maelstro/main.py
11+
# ports:
12+
# - 5678:5678

frontend/src/locales/fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
"Destination": "Destination",
3434
"Source title": "Titre de la source",
3535
"Destination title": "Titre de la destination",
36-
"Include harvested datasets": "Inclure les jeux de données moissonés"
36+
"Include harvested datasets": "Inclure les jeux de données moissonnés"
3737
}

frontend/src/views/FormView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
import { computed, ref } from 'vue'
2525
import { useI18n } from 'vue-i18n'
2626
27-
const includeHarvested = ref(true)
27+
const includeHarvested = ref(false)
2828
const confirmation = ref(false)
2929
3030
const configStore = useConfigStore()

0 commit comments

Comments
 (0)