Skip to content

Commit cfdc96f

Browse files
committed
🧱 dev-stack: switch local TLS to mkcert nip.io domains
**Problem** The local dev stack ships a committed self-signed CA and certificates for `*.docker.dev-franceconnect.fr`, a TLD that only works because the root CA is trusted manually on each machine. The stack also carries Cypress fixtures and a workflow for the retired integ01 environment. **Proposal** Move the local stack onto `*.proconnect.127.0.0.1.nip.io`, which resolves to 127.0.0.1 without hosts-file entries, and generate the TLS certificates on the fly with mkcert: the root CA lives in the local trust store, certs are gitignored, and `dks up` / a new `dks ssl` command refresh them when they expire. Drop the integ01 and k8s Cypress fixtures, their tag hooks, and the integration-tests workflow, and install mkcert in the CI stack jobs.
1 parent 8f4c47d commit cfdc96f

101 files changed

Lines changed: 331 additions & 1023 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Install mkcert
2+
description: Download and install the mkcert binary
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install mkcert
8+
shell: bash
9+
run: |
10+
curl -JLO "https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64"
11+
chmod +x mkcert-v1.4.4-linux-amd64
12+
sudo mv mkcert-v1.4.4-linux-amd64 /usr/local/bin/mkcert

.github/workflows/ci-admin-tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,16 @@ jobs:
7878
- name: Set ADMIN_ROOT environment variable
7979
run: echo "ADMIN_ROOT=$(pwd)" >> $GITHUB_ENV
8080

81+
- name: Install mkcert
82+
uses: ./.github/actions/install-mkcert
83+
8184
- name: Start docker stack
8285
working-directory: ./docker
8386
run: |
8487
./docker-stack prune-ci
8588
./docker-stack compose build core
8689
./docker-stack up admin
87-
./docker-stack wait "admin" "https://exploitation-fca-low.docker.dev-franceconnect.fr/login" "240"
90+
./docker-stack wait "admin" "https://admin-local.proconnect.127.0.0.1.nip.io/login" "240"
8891
8992
- name: Start tests
9093
run: yarn test:e2e -c video=false

.github/workflows/ci-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ jobs:
117117
working-directory: ./docker
118118
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
119119

120+
- name: Install mkcert
121+
uses: ./.github/actions/install-mkcert
122+
120123
- name: Start docker stack
121124
working-directory: ./docker
122125
run: |
@@ -195,6 +198,9 @@ jobs:
195198
run: |
196199
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
197200
201+
- name: Install mkcert
202+
uses: ./.github/actions/install-mkcert
203+
198204
- name: Start docker stack
199205
working-directory: ./docker
200206
run: |

.github/workflows/integration-tests.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ git clone git@github.com:proconnect-gouv/federation.git
7171
dks switch small
7272
```
7373

74-
On https://fsa1-low.docker.dev-franceconnect.fr/, you can test the connexion with: `test@fia1.fr`
74+
On https://sp1-local.proconnect.127.0.0.1.nip.io/, you can test the connexion with: `test@fia1.fr`
7575

7676
You are now connected to fsa1!
7777

@@ -85,7 +85,7 @@ Start it with:
8585
dks switch medium
8686
```
8787

88-
Then go to https://exploitation-fca-low.docker.dev-franceconnect.fr/login.
88+
Then go to https://admin-local.proconnect.127.0.0.1.nip.io/login.
8989

9090
Login with:
9191

@@ -97,9 +97,9 @@ More credentials can be found here : `federation-admin/shared/fixtures/User.yml`
9797

9898
### Testing the installation
9999

100-
You will then find a list of accessible URLs here: https://hello.docker.dev-franceconnect.fr.
100+
You will then find a list of accessible URLs here: https://proconnect.127.0.0.1.nip.io.
101101

102-
Most URLs follow the same pattern <app-name>.docker.dev-franceconnect.fr
102+
Most URLs follow the pattern <role>-local.proconnect.127.0.0.1.nip.io
103103

104104
On any URL, if you got a 502, it might still be booting, wait one minute, then reload.
105105

@@ -246,14 +246,6 @@ cd $PC_ROOT/federation/admin
246246
yarn lint --fix
247247
```
248248

249-
## Run test against integ01 env
250-
251-
```bash
252-
cd $PC_ROOT/federation/quality
253-
# Get the credentials from a team member
254-
CYPRESS_TEST_ENV=integ01 CYPRESS_EXPLOIT_USER_NAME=proconnect-test-local CYPRESS_EXPLOIT_USER_PASS='xxx' CYPRESS_EXPLOIT_USER_TOTP='xxx' yarn test:e2e:studio
255-
```
256-
257249
## Add a migration script
258250

259251
We use [migrate-mongo](https://www.npmjs.com/package/migrate-mongo) to manage the database migrations.

admin/cypress.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const REPOSITORY_ROOT = path.resolve(import.meta.dirname, "..");
77
export default defineConfig({
88
chromeWebSecurity: false,
99
e2e: {
10-
baseUrl: "https://exploitation-fca-low.docker.dev-franceconnect.fr",
10+
baseUrl: "https://admin-local.proconnect.127.0.0.1.nip.io",
1111
excludeSpecPattern: "cypress/integration/**/*.utils.js",
1212
experimentalRunAllSpecs: true,
1313
retries: 2,
@@ -20,13 +20,13 @@ export default defineConfig({
2020
},
2121
env: {
2222
APP_FORBIDDEN_PAGE:
23-
"https://exploitation-fca-low.docker.dev-franceconnect.fr/service-provider",
23+
"https://admin-local.proconnect.127.0.0.1.nip.io/service-provider",
2424
APP_HOME_ROLE_ADMIN:
25-
"https://exploitation-fca-low.docker.dev-franceconnect.fr/account",
25+
"https://admin-local.proconnect.127.0.0.1.nip.io/account",
2626
APP_HOME_ROLE_OPERATOR:
27-
"https://exploitation-fca-low.docker.dev-franceconnect.fr/service-provider",
27+
"https://admin-local.proconnect.127.0.0.1.nip.io/service-provider",
2828
APP_HOME_ROLE_SECURITY:
29-
"https://exploitation-fca-low.docker.dev-franceconnect.fr/service-provider",
29+
"https://admin-local.proconnect.127.0.0.1.nip.io/service-provider",
3030
APP_NAME: "admin",
3131
FEDERATION_DIR: REPOSITORY_ROOT,
3232
LOG_FILE_PATH: `${REPOSITORY_ROOT}/docker/volumes/log/fcexploitation.log`,

admin/cypress/integration/account/account-roles.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88

99
describe("Account", () => {
1010
before(() => cy.resetEnv("postgres"));
11-
it("should redirect the not connected user to https://fc-exploitation.docker.dev-franceconnect.fr/login", () => {
11+
it("should redirect the not connected user to https://admin-local.proconnect.127.0.0.1.nip.io/login", () => {
1212
cy.visit(`/account`);
1313
cy.url().should("contain", `/login`);
1414
});

admin/cypress/integration/service-provider/service-provider-generate-new-client-secret.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("update a service-provider", () => {
3838
// Assert
3939
cy.url().should(
4040
"eq",
41-
"https://exploitation-fca-low.docker.dev-franceconnect.fr/service-provider",
41+
"https://admin-local.proconnect.127.0.0.1.nip.io/service-provider",
4242
);
4343
cy.contains(
4444
`Le fournisseur de service ${fs.name} a été créé avec succès !`,

admin/cypress/integration/service-provider/service-provider-list.spec.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ const fs2 = { ...fs, name: "CypressFS2" };
2222
const fs3 = { ...fs, name: "CypressFS3" };
2323

2424
describe("Service provider list", () => {
25+
let creationDate;
26+
2527
before(() => {
2628
cy.resetEnv("mongo");
2729
cy.login(USER_OPERATOR, USER_PASS);
30+
creationDate = getTodayDate();
2831
createServiceProvider(fs, basicConfiguration);
2932
createServiceProvider(fs2, basicConfiguration);
3033
createServiceProvider(fs3, basicConfiguration);
@@ -44,9 +47,8 @@ describe("Service provider list", () => {
4447
cy.get(".time-client-id")
4548
.last()
4649
.then((item) => {
47-
const todayDate = getTodayDate();
4850
const test = item[0].textContent;
49-
expect(todayDate).to.equal(test);
51+
expect(creationDate).to.equal(test);
5052
});
5153
});
5254

@@ -59,9 +61,8 @@ describe("Service provider list", () => {
5961
cy.get(".time-secret")
6062
.last()
6163
.then((item) => {
62-
const todayDate = getTodayDate();
6364
const test = item[0].textContent;
64-
expect(todayDate).to.equal(test);
65+
expect(creationDate).to.equal(test);
6566
});
6667
});
6768

admin/src/config/app.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { Platform } from "../utils/instance.enum";
33

44
export default {
55
appName: process.env.APP_NAME || "Admin ProConnect",
6-
appFqdn:
7-
process.env.APP_FQDN || "fc-exploitation.docker.dev-franceconnect.fr",
6+
appFqdn: process.env.APP_FQDN || "admin-local.proconnect.127.0.0.1.nip.io",
87
environment: process.env.ENV_NAME || "development",
98
app_root: process.env.APP_ROOT || "",
109
commitUrlPrefix:

0 commit comments

Comments
 (0)