Skip to content

Commit

Permalink
Merge pull request #223 from MTES-MCT/prod_config
Browse files Browse the repository at this point in the history
Add separate config files for prod and integration
  • Loading branch information
louptheron authored Mar 22, 2021
2 parents a9c4944 + d7cdbc1 commit 290e665
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 11 deletions.
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ restart-remote-app:
cd infra/remote && sudo docker-compose pull && sudo docker-compose up -d --build app
run-local-app:
cd infra/local && sudo docker-compose up -d
run-pipeline-server:
docker pull docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:v0.1.0_snapshot
infra/remote/data-pipeline/start-server.sh
run-pipeline-flows:
docker pull docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:v0.1.0_snapshot && \
run-pipeline-server-prod:
docker pull docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION)
infra/remote/data-pipeline/prod/start-server.sh
run-pipeline-server-int:
docker pull docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION)
infra/remote/data-pipeline/int/start-server.sh
run-pipeline-flows-prod:
docker pull docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION) && \
infra/remote/data-pipeline/start-flows.sh
run-pipeline-flows-int:
docker pull docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION) && \
infra/remote/data-pipeline/start-flows.sh
stop-pipeline-server:
infra/remote/data-pipeline/stop-server.sh
stop-pipeline-flows:
docker container stop monitorfish-pipeline-flows; docker container rm monitorfish-pipeline-flows;


# DATA commands
install-pipeline:
cd datascience && poetry install
Expand Down
2 changes: 2 additions & 0 deletions infra/configurations/prefect-server/int/backend.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
backend = "server"

3 changes: 3 additions & 0 deletions infra/configurations/prefect-server/int/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[server]
[server.ui]
apollo_url="http://prefect-test.csam.e2.rie.gouv.fr/graphql"
2 changes: 2 additions & 0 deletions infra/configurations/prefect-server/prod/backend.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
backend = "server"

3 changes: 3 additions & 0 deletions infra/configurations/prefect-server/prod/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[server]
[server.ui]
apollo_url="http://prefect.csam.e2.rie.gouv.fr/graphql"
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ docker run -t --rm --network=host --name monitorfish-pipeline-flows \
-v prefect_flows:/home/monitorfish-pipeline/.prefect \
-u monitorfish-pipeline:"$(getent group di_etlmf | cut -d: -f3)" \
--env-file datascience/.env \
docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:v0.1.0_snapshot \
docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION) \
python main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

docker run -t --rm --network=host --name monitorfish-pipeline-server \
-u monitorfish-pipeline:$(getent group docker | cut --delimiter=":" -f3) \
-v "$(pwd)"/infra/configurations/prefect-server:/home/monitorfish-pipeline/.prefect \
-v /var/run/docker.sock:/var/run/docker.sock docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:v0.1.0_snapshot \
-v "$(pwd)"/infra/configurations/prefect-server/int:/home/monitorfish-pipeline/.prefect \
-v /var/run/docker.sock:/var/run/docker.sock docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION) \
prefect server start --use-volume --volume-path ~/.prefect/server/pg_data --postgres-port "5433"
8 changes: 8 additions & 0 deletions infra/remote/data-pipeline/prod/start-flows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

docker run -t --rm --network=host --name monitorfish-pipeline-flows \
-v prefect_flows:/home/monitorfish-pipeline/.prefect \
-u monitorfish-pipeline:"$(getent group dp_etlmf | cut -d: -f3)" \
--env-file datascience/.env \
docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION) \
python main.py
7 changes: 7 additions & 0 deletions infra/remote/data-pipeline/prod/start-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

docker run -t --rm --network=host --name monitorfish-pipeline-server \
-u monitorfish-pipeline:$(getent group docker | cut --delimiter=":" -f3) \
-v "$(pwd)"/infra/configurations/prefect-server/prod:/home/monitorfish-pipeline/.prefect \
-v /var/run/docker.sock:/var/run/docker.sock docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION) \
prefect server start --use-volume --volume-path ~/.prefect/server/pg_data --postgres-port "5433"
2 changes: 1 addition & 1 deletion infra/remote/data-pipeline/stop-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ docker container rm monitorfish-pipeline-server;
docker container rm monitorfish-pipeline-server;
docker run -t --rm --network=host --name monitorfish-pipeline-server \
-u monitorfish-pipeline:$(getent group docker | cut --delimiter=":" -f3) \
-v /var/run/docker.sock:/var/run/docker.sock docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:v0.1.0_snapshot \
-v /var/run/docker.sock:/var/run/docker.sock docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline:$(MONITORFISH-VERSION) \
prefect server stop;
)
2 changes: 1 addition & 1 deletion infra/remote/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
restart: always

app:
image: docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-app:v0.0.1_snapshot
image: docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-app:$(MONITORFISH-VERSION)
environment:
- ENV_DB_URL=jdbc:postgresql://db:5432/monitorfishdb?user=postgres&password=postgres
- HOST_IP=127.0.0.1
Expand Down

0 comments on commit 290e665

Please sign in to comment.