Skip to content

Commit e986eaf

Browse files
committed
Rudimentary Dockerfile and compose
1 parent a3eae90 commit e986eaf

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

compose.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ services:
127127
- action: rebuild
128128
path: collab
129129
target: collab/app
130+
131+
nginx:
132+
build: nginx
133+
ports:
134+
- "80:80"
130135
# mongo:
131136
# image: "mongo:latest"
132137
# ports:

nginx/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM nginx:alpine
2+
COPY nginx.conf /etc/nginx/nginx.conf
3+
EXPOSE 80
4+
CMD ["nginx", "-g", "daemon off;"]

nginx/nginx.conf

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ http {
3131

3232
# frontend (i guess login page)
3333
location / {
34-
proxy_pass http://localhost:3000/; # frontend running on...similar for other services
34+
proxy_pass http://peerprep:3000/; # frontend running on...similar for other services
3535
proxy_http_version 1.1;
3636
proxy_set_header Upgrade $http_upgrade;
3737
proxy_set_header Connection "Upgrade";
@@ -40,35 +40,32 @@ http {
4040
}
4141

4242
# question
43-
location /api/ {
44-
proxy_pass http://localhost:9090/;
43+
location ~ ^/api/(?!internal).*$ {
44+
proxy_pass http://backend:9090/;
45+
proxy_set_header Host $host;
46+
proxy_set_header X-Real-IP $remote_addr;
47+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
48+
proxy_set_header X-Forwarded-Proto $scheme;
49+
4550
}
4651

47-
# # user (pure conjecture, just referencing gaylord article)
48-
# location /users/ {
49-
# auth_request auth;
50-
# auth_request_set $userid $upstream_http_x_auth_user;
52+
# user (pure conjecture, just referencing gaylord article)
53+
location /users/ {
54+
proxy_pass http://user-service:3001/;
55+
# auth_request auth;
56+
# auth_request_set $userid $upstream_http_x_auth_user;
5157

52-
# # if fail go back to landing
53-
# if ($http_accept ~* "text/html" ) {
54-
# error_page 401 403 =200 /;
55-
# }
56-
# proxy_set_header X-Auth-User $userid;
57-
# proxy_set_header Host $host;
58-
# proxy_set_header X-Forwarded-For $remote_addr;
59-
# proxy_pass http://localhost:3001/;
60-
61-
# }
62-
63-
# location = auth {
64-
# internal;
65-
# # proxy_pass to authenticator service
66-
# proxy_set_header Content-Length "";
67-
# proxy_set_header X-Dbg $cookie_AUTH;
68-
69-
# proxy_cache auth_cache;
70-
# proxy_cache_valid 200 204 1m;
71-
# proxy_cache_key "$http_authorization"; # jwt?
72-
# }
58+
# # if fail go back to landing
59+
# if ($http_accept ~* "text/html" ) {
60+
# error_page 401 403 =200 /;
61+
# }
62+
63+
proxy_set_header X-Auth-User $userid;
64+
proxy_set_header Host $host;
65+
proxy_set_header X-Forwarded-For $remote_addr;
66+
67+
68+
}
69+
7370
}
7471
}

0 commit comments

Comments
 (0)