Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add preprod #3661

Merged
merged 4 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .infra/ansible/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
tasks:
- include_tasks: ./tasks/files_copy.yml

- name: Création du docker-compose.yml {{env_type}}
shell:
chdir: /opt/app
cmd: 'sudo docker compose $(for file in $(ls docker-compose.*.yml); do echo -n "-f $file "; done) config -o docker-compose.yml'
register: docker_deploy_output

- name: Récupération des images docker
shell:
chdir: /opt/app
cmd: "sudo docker compose pull"
cmd: "/opt/app/tools/docker-compose.sh pull"

- name: Récupération du status de la stack
shell:
Expand Down
2 changes: 1 addition & 1 deletion .infra/ansible/tasks/files_copy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
dest: "/opt/app/docker-compose.recette.yml"
with_fileglob:
- "{{inventory_dir}}/docker-compose.recette.yml"
when: env_type == 'recette'
when: env_type == 'recette' or env_type == 'preprod'

- name: creation du fichier docker compose preview system
ansible.builtin.template:
Expand Down
7 changes: 7 additions & 0 deletions .infra/env.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ dns_name=cfas-recette.apprentissage.beta.gouv.fr
host_name=tableau-de-bord-recette
env_type=recette

[preprod]
147.135.140.81
[preprod:vars]
dns_name=tableau-de-bord-preprod.apprentissage.beta.gouv.fr
host_name=tdb-preprod
env_type=preprod

[preview]
51.75.253.210
[preview:vars]
Expand Down
2 changes: 1 addition & 1 deletion .infra/files/scripts/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -euo pipefail
#Needs to be run as sudo

docker compose run --rm --no-deps server yarn cli "$@"
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli "$@"
2 changes: 1 addition & 1 deletion .infra/files/scripts/migrations-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -euo pipefail
#Needs to be run as sudo

docker compose run --rm --no-deps server yarn cli migrations:status
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli migrations:status
2 changes: 1 addition & 1 deletion .infra/files/scripts/migrations-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

run_migrations(){
echo "Application des migrations ..."
docker compose run --rm --no-deps server yarn cli migrations:up 2>&1 | tee "$LOG_FILEPATH"
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli migrations:up 2>&1 | tee "$LOG_FILEPATH"
}

run_migrations
2 changes: 1 addition & 1 deletion .infra/files/scripts/trigger-indexes-creation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

trigger_indexes_creation(){
echo "Création des index mongoDb ..."
docker compose run --rm --no-deps server yarn cli indexes:create --queued
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli indexes:create --queued
}

trigger_indexes_creation
1,558 changes: 848 additions & 710 deletions .infra/vault/vault.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fileignoreconfig:
- filename: .infra/files/scripts/seed.sh
checksum: a7052d0a4ce7ca9e36e4072aa0a651d32b5db91643cc9d80cfe821f0efe0dc2a
- filename: .infra/vault/vault.yml
checksum: 72f50b0545da8f59d9e60f40d7d4df75c2be1a220ec98ee79dd686d4ae786a0b
checksum: 0a47929f0aa53717f31e2aa38528132cad22b78335255e56aafacd350797ec01
- filename: .infra_previous/ansible/roles/setup/files/app/.overrides/dev/docker-compose.env.yml
checksum: fa8c4331bd9b5a35772d5f5ea52c36393e0336bf8c70aedb9e5c214e4f8c9636
- filename: .infra_previous/ansible/roles/setup/files/app/.overrides/production/docker-compose.env.yml
Expand Down
5 changes: 4 additions & 1 deletion docker-bake.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"recette": {
"targets": ["server", "ui-recette"]
},
"preprod": {
"targets": ["server", "ui-preprod"]
},
"preview": {
"targets": ["server", "ui-preview"]
},
Expand Down Expand Up @@ -46,7 +49,7 @@
"ui": {
"inherits": ["common"],
"matrix": {
"ENV": ["production", "recette", "preview", "local"]
"ENV": ["production", "recette", "preprod", "preview", "local"]
},
"name": "ui-${ENV}",
"args": {
Expand Down
1 change: 1 addition & 0 deletions server/src/jobs/seed/plausible/goals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { plausibleGoals } from "shared";
const plausibleDomains = [
"cfas.apprentissage.beta.gouv.fr",
"cfas-recette.apprentissage.beta.gouv.fr",
"tableau-de-bord-preprod.apprentissage.beta.gouv.fr",
"cfas-dev.apprentissage.beta.gouv.fr",
];

Expand Down
23 changes: 22 additions & 1 deletion ui/config.public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface PublicConfig {
sentry_dsn: string;
baseUrl: string;
host: string;
env: "local" | "recette" | "production" | "preview";
env: "local" | "recette" | "production" | "preview" | "preprod";
version: string;
matomo: {
url: string;
Expand Down Expand Up @@ -50,6 +50,24 @@ function getRecettePublicConfig(): PublicConfig {
};
}

function getPreprodPublicConfig(): PublicConfig {
const host = "tableau-de-bord-preprod.apprentissage.beta.gouv.fr";

return {
sentry_dsn: SENTRY_DSN,
env: "preprod",
host,
baseUrl: `https://${host}`,
matomo: {
url: "https://stats.beta.gouv.fr",
siteId: "",
jsTrackerFile: "",
disableCookies: true,
},
version: getVersion(),
};
}

function getPreviewPublicConfig(): PublicConfig {
const version = getVersion();
const matches = version.match(/^0\.0\.0-(\d+)$/);
Expand Down Expand Up @@ -108,6 +126,7 @@ function getEnv(): PublicConfig["env"] {
switch (env) {
case "production":
case "recette":
case "preprod":
case "preview":
case "local":
return env;
Expand All @@ -122,6 +141,8 @@ function getPublicConfig(): PublicConfig {
return getProductionPublicConfig();
case "recette":
return getRecettePublicConfig();
case "preprod":
return getPreprodPublicConfig();
case "preview":
return getPreviewPublicConfig();
case "local":
Expand Down
2 changes: 1 addition & 1 deletion ui/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const contentSecurityPolicy = `
block-all-mixed-content;
font-src 'self' https: data:;
frame-ancestors 'self' https://cfas.apprentissage.beta.gouv.fr;
frame-src 'self' https://plausible.io https://cfas.apprentissage.beta.gouv.fr https://cfas-recette.apprentissage.beta.gouv.fr;
frame-src 'self' https://plausible.io https://cfas.apprentissage.beta.gouv.fr https://cfas-recette.apprentissage.beta.gouv.fr https://tableau-de-bord-preprod.apprentissage.beta.gouv.fr;
img-src 'self' https://files.tableau-de-bord.apprentissage.beta.gouv.fr https://www.notion.so https://mission-apprentissage.notion.site https://stats.beta.gouv.fr data:;
object-src 'none';
script-src 'self' https://plausible.io https://stats.beta.gouv.fr ${
Expand Down
Loading