Skip to content

Commit 92e29db

Browse files
committed
feat: add a docker compose deployment example
1 parent fb5846c commit 92e29db

File tree

8 files changed

+263
-0
lines changed

8 files changed

+263
-0
lines changed

deployment-examples/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
docker-data
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DATABASE_URL=postgresql://sill:pg_password@postgres:5432/sill
2+
API_PORT=3084
3+
EXTERNAL_SOFTWARE_DATA_ORIGIN=wikidata
4+
README_URL=https://git.sr.ht/~codegouvfr/logiciels-libres/blob/main/sill.md
5+
TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
6+
7+
VITE_HEAD="
8+
<title>Catalogi - Deployment exemple</title>
9+
10+
<script defer>
11+
console.log('This is a custom code in head');
12+
</script>
13+
"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Deploying a Catalogi instance
2+
3+
This is a simple example of how to deploy a Catalogi instance, using Docker and Docker Compose.
4+
5+
## Requirements
6+
7+
- Docker
8+
- Docker Compose
9+
10+
## Configure
11+
12+
First, copy the `.env.sample` and name it `.env` in the root of the project.
13+
14+
```bash
15+
cp .env.sample .env
16+
```
17+
18+
Then, edit the `.env` file to set the environment variables.
19+
You can use the default values for dev.
20+
21+
## Auth Configuration
22+
23+
The deployment uses https://auth.code.gouv.fr as the OIDC provider. It is the original first project using Catalogi, this is why it is used as the default. However, you should use your own OIDC provider (or use Keycloak to create your own).
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/codegouvfr/sill/refs/heads/main/api/src/rpc/translations/schema.json",
3+
"home": {
4+
"title": "This is a custom title"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/codegouvfr/sill/refs/heads/main/api/src/rpc/translations/schema.json",
3+
"home": {
4+
"title": "Ceci est un titre personnalisé"
5+
}
6+
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"header": {
3+
"link": {
4+
"linkProps": {
5+
"href": "https://code.gouv.fr"
6+
},
7+
"text": "Code Gouv"
8+
},
9+
"menu": {
10+
"welcome": {
11+
"enabled": true
12+
},
13+
"catalog": {
14+
"enabled": true
15+
},
16+
"addSoftware": {
17+
"enabled": true
18+
},
19+
"about": {
20+
"enabled": false
21+
},
22+
"contribute": {
23+
"enabled": true,
24+
"href": "mailto:[email protected]?subject=Demande d'accompagnement"
25+
}
26+
}
27+
},
28+
"home": {
29+
"softwareSelection": {
30+
"enabled": true
31+
},
32+
"theSillInAFewWordsParagraphLinks": [
33+
"https://fr.wikipedia.org/wiki/Logiciel_libre",
34+
"https://www.legifrance.gouv.fr/jorf/article_jo/JORFARTI000033203039",
35+
"https://code.gouv.fr/sill/readme",
36+
"https://code.gouv.fr/fr/doc/licences-libres-dinum"
37+
],
38+
"searchBar": {
39+
"enabled": false
40+
},
41+
"statistics": {
42+
"categories": ["softwareCount", "registeredUserCount", "agentReferentCount", "organizationCount"]
43+
},
44+
"usecases": {
45+
"declareReferent": {
46+
"enabled": true,
47+
"labelLinks": [],
48+
"buttonEnabled": true,
49+
"buttonLink": ""
50+
},
51+
"editSoftware": {
52+
"enabled": true,
53+
"labelLinks": [],
54+
"buttonEnabled": true,
55+
"buttonLink": ""
56+
},
57+
"addSoftwareOrService": {
58+
"enabled": true,
59+
"labelLinks": [],
60+
"buttonEnabled": true,
61+
"buttonLink": ""
62+
}
63+
},
64+
"quickAccess": {
65+
"enabled": false
66+
}
67+
},
68+
"softwareDetails": {
69+
"authorCard": false,
70+
"defaultLogo": true,
71+
"details": {
72+
"enabled": true,
73+
"fields": {
74+
"registerDate": true,
75+
"minimalVersionRequired": true,
76+
"softwareCurrentVersion": true,
77+
"softwareCurrentVersionDate": true,
78+
"license": true
79+
}
80+
},
81+
"prerogatives": {
82+
"enabled": true
83+
},
84+
"metadata": {
85+
"enabled": true,
86+
"fields": {
87+
"keywords": true,
88+
"programmingLanguages": true,
89+
"applicationCategories": true,
90+
"softwareType": true
91+
}
92+
},
93+
"links": {
94+
"enabled": true
95+
},
96+
"userActions": {
97+
"enabled": true
98+
}
99+
},
100+
"catalog": {
101+
"defaultLogo": true,
102+
"search": {
103+
"options": {
104+
"organisation": true,
105+
"applicationCategories": true,
106+
"softwareType": true,
107+
"prerogatives": true,
108+
"programmingLanguages": false
109+
}
110+
},
111+
"sortOptions": {
112+
"referent_count": true,
113+
"user_count": true,
114+
"added_time": true,
115+
"update_time": true,
116+
"latest_version_publication_date": true,
117+
"user_count_ASC": true,
118+
"referent_count_ASC": true
119+
},
120+
"cardOptions": {
121+
"referentCount": true,
122+
"userCase": true
123+
}
124+
},
125+
"footer": {
126+
"domains": ["info.gouv.fr", "service-public.fr", "legifrance.gouv.fr", "data.gouv.fr"]
127+
}
128+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
services:
2+
# the frontend container
3+
web:
4+
platform: linux/amd64
5+
image: codegouvfr/catalogi-web:latest # you should use a specific version here. See here : https://hub.docker.com/r/codegouvfr/catalogi-web/tags
6+
depends_on:
7+
- api
8+
restart: unless-stopped
9+
env_file: .env
10+
11+
# the api that the frontend will call
12+
api:
13+
platform: linux/amd64
14+
image: codegouvfr/catalogi-api:latest # you should use a specific version here. See here : https://hub.docker.com/r/codegouvfr/catalogi-api/tags
15+
depends_on:
16+
- postgres
17+
env_file: .env
18+
restart: unless-stopped
19+
command: yarn start
20+
volumes:
21+
- ./customization:/app/api/dist/src/customization
22+
23+
# this is the background task that will update the database every 4 hours
24+
update:
25+
platform: linux/amd64
26+
image: codegouvfr/catalogi-api:latest # you should use a specific version here. See here : https://hub.docker.com/r/codegouvfr/catalogi-api/tags
27+
depends_on:
28+
- api
29+
- postgres
30+
env_file: .env
31+
restart: always
32+
# runs every 4 hours (240 minutes)
33+
command: yarn update-then-wait 240
34+
35+
# this is nginx managing the proxy (sending /api requests to the api container, the rest to the web container)
36+
nginx:
37+
image: nginx:alpine
38+
ports:
39+
- "8090:80"
40+
volumes:
41+
- ./nginx/:/etc/nginx/conf.d/
42+
depends_on:
43+
- api
44+
- web
45+
restart: unless-stopped
46+
47+
# optional, as your DB could be hosted elsewhere
48+
postgres:
49+
image: postgres:16
50+
shm_size: 256m
51+
environment:
52+
POSTGRES_LOG_STATEMENTS: all
53+
POSTGRES_DB: ${POSTGRES_DB}
54+
POSTGRES_USER: ${POSTGRES_USER}
55+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
56+
volumes:
57+
- ./docker-data:/var/lib/postgresql/data
58+
restart: unless-stopped
59+
60+
# optional, gives a UI (an old school one yet useful) to access the data in the DB
61+
adminer:
62+
image: adminer
63+
ports:
64+
- "8091:8080"
65+
restart: unless-stopped
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
upstream web {
2+
server web:8080;
3+
}
4+
5+
upstream api {
6+
server api:3084;
7+
}
8+
9+
server {
10+
listen 80;
11+
12+
location / {
13+
proxy_pass http://web;
14+
}
15+
16+
location /api {
17+
rewrite /api/(.*) /$1 break;
18+
proxy_pass http://api;
19+
}
20+
}

0 commit comments

Comments
 (0)