Skip to content

Commit 91e7adc

Browse files
Merge pull request #559 from elixir-luxembourg/move-nginx-to-volume
Move nginx config to template
2 parents fb82313 + 9f81233 commit 91e7adc

File tree

5 files changed

+45
-8
lines changed

5 files changed

+45
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,4 @@ web/static/js/*.bundle.js.LICENSE.txt
173173
/documents
174174
/web/static/css/daisy.min.css
175175
/web/static/css/daisy.css
176+
/docker/nginx/nginx.conf

doc/deployment.md

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ Create a `.env` file in the project root to override default environment variabl
2424

2525
## Installation
2626

27+
### Configure Nginx
28+
29+
Copy the Nginx configuration template:
30+
31+
```bash
32+
cp ./docker/nginx/nginx.conf.template ./docker/nginx/nginx.conf
33+
```
34+
Customize `nginx.conf` as needed and then start or restart the Nginx service:
35+
36+
```bash
37+
docker compose restart nginx
38+
```
39+
2740
### Build and Start Services
2841

2942
Build and start all services defined in `docker-compose.yaml`:

docker-compose.yaml

+10-7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ services:
2121
db:
2222
image: postgres:16.4-bullseye
2323
restart: unless-stopped
24+
expose:
25+
- "5432"
2426
environment:
2527
POSTGRES_PASSWORD: ${DB_PASSWORD:-daisy}
2628
POSTGRES_USER: ${DB_USER:-daisy}
@@ -35,6 +37,7 @@ services:
3537
restart: unless-stopped
3638
volumes:
3739
- statics:/public/static:ro
40+
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
3841
ports:
3942
- '80:80'
4043
- '443:443'
@@ -46,8 +49,8 @@ services:
4649
solr:
4750
build: ./docker/solr
4851
restart: unless-stopped
49-
ports:
50-
- "8983:8983"
52+
expose:
53+
- "8983"
5154
networks:
5255
- daisy_network
5356
volumes:
@@ -58,15 +61,15 @@ services:
5861
restart: unless-stopped
5962
networks:
6063
- daisy_network
61-
ports:
62-
- "15672:15672"
63-
- "5672:5672"
64+
expose:
65+
- "15672"
66+
- "5672"
6467
# task monitoring
6568
flower:
6669
image: mher/flower:0.9.7
6770
command: --broker=amqp://guest:guest@mq:5672// --broker_api=http://guest:guest@mq:15672/api/
68-
ports:
69-
- "5555:5555"
71+
expose:
72+
- "5555"
7073
restart: unless-stopped
7174
networks:
7275
- daisy_network

docker/nginx/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM nginx:alpine
2-
COPY nginx.conf /etc/nginx/nginx.conf
2+
RUN rm /etc/nginx/nginx.conf
33
COPY server.key /etc/nginx/ssl/private/server.key
44
COPY server.crt /etc/nginx/ssl/certs/server.crt

docker/nginx/nginx.conf docker/nginx/nginx.conf.template

+20
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,27 @@ http {
3838
server_name localhost;
3939
listen 80 default_server;
4040
listen [::]:80 default_server;
41+
42+
# Comment the line below to disable HTTPS redirect and use HTTP directly
4143
return 302 https://$host$request_uri;
44+
45+
# Uncomment these location blocks when you want to serve HTTP directly
46+
# location @proxy_to_app {
47+
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
48+
# proxy_set_header X-Forwarded-Proto http;
49+
# proxy_set_header X-Real-IP $remote_addr;
50+
# proxy_set_header Host $http_host;
51+
# proxy_redirect off;
52+
# proxy_pass http://app_server;
53+
# }
54+
#
55+
# location /static/ {
56+
# root /public/ ;
57+
# }
58+
#
59+
# location / {
60+
# try_files $uri $uri/ @proxy_to_app;
61+
# }
4262
}
4363

4464
server_tokens off;

0 commit comments

Comments
 (0)