-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Group deployment files in a single folder
- Loading branch information
1 parent
cc0f6af
commit 32f3462
Showing
15 changed files
with
88 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
run-datawarehouse: | ||
docker compose -f ./docker-compose.yml up -d | ||
register-forklift-flows: | ||
docker pull ghcr.io/mtes-mct/fisheries-and-environment-data-warehouse/forklift:$(FORKLIFT_VERSION) && \ | ||
./register-flows.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## Data Warehouse Deployment | ||
### 1. Purpose and Architecture | ||
|
||
This Data Warehouse is meant to collect data from Monitorfish, Monitorenv and Rapportnav V2 applications and provide | ||
a centralized database for statistical analysis through data querying and visualization tools such as Metabase. | ||
|
||
It is composed of 2 dockerized services : | ||
- a Clickhouse database | ||
- a set of python data flows orchestrated by Prefect, named `Forklift` | ||
|
||
### 2. Deployment | ||
#### 2.1. Prerequisites | ||
|
||
- Install docker : https://docs.docker.com/engine/install/debian/#install-using-the-repository | ||
- Install GNU make if not already installed : | ||
`sudo apt-get update` | ||
`sudo apt-get install make` | ||
- Install pyenv : https://github.com/pyenv/pyenv-installer | ||
- Install python : `pyenv install 3.12.3` | ||
- Copy the contents of the `infra/deployment` folder onto the host machine, in the `~` folder. | ||
- Create a virtual environment in the `~/prefect-agent` folder and install `prefect` in this virtual environment : | ||
- `cd prefect-agent` | ||
- `pyenv local 3.12.3` | ||
- `python -m venv .venv` | ||
- `source .venv/bin/activate` | ||
- `pip install prefect=1.3.0` | ||
- Run `prefect backend server` to switch Prefect into server mode (as opposed to cloud mode, the default). A file `backend.toml` should appear at `~/.prefect/backend.toml` containing `backend = "server"`. | ||
- Define and start a Prefect agent service: | ||
- Fill in the placeholders in `.prefect-agent` and `prefectdockeragent.service`. | ||
- Move `prefectdockeragent.service` into `/etc/systemd/system`. | ||
- Run `sudo systemctl enable prefectdockeragent.service` to enable the service. | ||
- Run `sudo systemctl start prefectdockeragent.service` to start the service. | ||
- Run `systemctl status prefectdockeragent.service` to check the service is running. | ||
- Rename `.env.template` as `.env` and fill in the environement variables : these are the environment variables that will be used by the flow runners, inside the forklift runner containers. | ||
|
||
#### 2.2. Running the Data Warehouse | ||
|
||
- Update the `DATA_WAREHOUSE_USER` and `DATA_WAREHOUSE_PASSWORD` environment variables in the `.data-warehouse` file. | ||
- Run `source .data-warehouse`. | ||
- Run `make run-datawarehouse`. | ||
|
||
#### 2.3. Running or updating `Forklift` | ||
|
||
- Update the `FORKLIFT_VERSION` variable in the `.data-warehouse` file. | ||
- Run `source .data-warehouse`. | ||
- Run `make register-forklift-flows`. |
File renamed without changes.
1 change: 0 additions & 1 deletion
1
infra/data_warehouse/docker-compose.yml → infra/deployment/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: '3' | ||
services: | ||
db: | ||
image: clickhouse/clickhouse-server:23.11.4.24 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PREFECT_SERVER_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Prefect Docker Agent | ||
|
||
[Service] | ||
Type=simple | ||
|
||
User=<USER-TO-CHANGE> | ||
ExecStart=<SCRIPT-LOCATION-TO-CHANGE>/prefectdockeragent.sh | ||
Restart=always | ||
RestartSec=30 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
source ~/prefect-agent/.venv/bin/activate && \ | ||
source ~/prefect-agent/.prefect-agent && \ | ||
prefect agent docker start --api "${PREFECT_SERVER_URL}" --label forklift; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
docker run -t --rm --network=host --name forklift-register-flows \ | ||
-v /opt2/sacrois-data:/opt2/sacrois-data \ | ||
-v "$(pwd)"/.env:/home/forklift/data_warehouse/.env \ | ||
-v "$(pwd)"/backend.toml:/home/forklift/.prefect/backend.toml \ | ||
--env-file .env \ | ||
-e FORKLIFT_VERSION \ | ||
-e SACROIS_FILES_GID \ | ||
ghcr.io/mtes-mct/fisheries-and-environment-data-warehouse/forklift:$FORKLIFT_VERSION \ | ||
python forklift/main.py |
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...warehouse/docker-compose-dev-metabase.yml → ...a/testing/docker-compose-dev-metabase.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: '3' | ||
services: | ||
|
||
metabase-db: | ||
|
1 change: 0 additions & 1 deletion
1
...ta_warehouse/docker-compose-test-data.yml → infra/testing/docker-compose-test-data.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: '3' | ||
services: | ||
|
||
monitorfish-db: | ||
|