-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from katelovestocode/BE-20-connect-to-AWS
BE-20-connect-to-aws
- Loading branch information
Showing
15 changed files
with
210 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,4 @@ lerna-debug.log* | |
!.vscode/extensions.json | ||
|
||
.env | ||
pgdata/ | ||
#pgdata/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#base | ||
FROM node:18-alpine As base | ||
|
||
WORKDIR /app | ||
|
||
COPY package*.json ./ | ||
|
||
COPY . . | ||
|
||
EXPOSE 3002 | ||
|
||
RUN npm install | ||
|
||
# to run tests | ||
FROM base As test | ||
|
||
WORKDIR /app | ||
|
||
COPY test ./test | ||
|
||
CMD [ "npm", "run", "test" ] | ||
|
||
# to run in production | ||
FROM base As prod | ||
|
||
WORKDIR /app | ||
|
||
RUN npm run build | ||
|
||
ENV PORT=3002 | ||
|
||
ENV HOSTNAME="0.0.0.0" | ||
|
||
CMD [ "npm", "run", "start:prod" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Dockerfile.nginx | ||
|
||
FROM nginx:1.23.3-alpine | ||
|
||
# Create a non-privileged user for running Nginx | ||
RUN adduser --disabled-password --gecos '' nginxuser | ||
|
||
RUN mkdir -p /var/cache/nginx/client_temp \ | ||
&& mkdir -p /var/cache/nginx/proxy_temp \ | ||
&& mkdir -p /var/cache/nginx/fastcgi_temp \ | ||
&& chown -R nginxuser:nginxuser /var/cache/nginx | ||
|
||
# Create the directory for PID file | ||
RUN mkdir -p /var/run/nginx/ | ||
|
||
# Set appropriate permissions for the PID directory | ||
RUN chown -R nginxuser:nginxuser /var/run/nginx/ | ||
|
||
# Create the directory for SSL certificates | ||
RUN mkdir -p /etc/ssl/private/ | ||
|
||
# Create the directory for Nginx cache | ||
RUN mkdir -p /var/cache/nginx/client_temp | ||
RUN mkdir -p /var/cache/nginx/proxy_temp | ||
RUN mkdir -p /var/cache/nginx/fastcgi_temp | ||
|
||
RUN chown -R nginxuser:nginxuser /var/cache/nginx | ||
|
||
# Copy SSL certificates into the Docker image | ||
COPY certificate.crt /etc/ssl/private/certificate.crt | ||
COPY private.key /etc/ssl/private/private.key | ||
|
||
# Copy Nginx configuration file | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
EXPOSE 80 443 | ||
|
||
USER nginxuser | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
user nginxuser; | ||
pid /tmp/nginx.pid; | ||
|
||
events { | ||
} | ||
|
||
http { | ||
upstream backend { | ||
server backend:3002; | ||
} | ||
|
||
server { | ||
# Redirect HTTP requests to HTTPS. | ||
listen 80; | ||
server_name localhost; | ||
root /srv/public; | ||
return 301 https://$host$request_uri; | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
|
||
server_name localhost; | ||
root /srv/public; | ||
server_tokens off; | ||
|
||
ssl_certificate /etc/ssl/private/certificate.crt; | ||
ssl_certificate_key /etc/ssl/private/private.key; | ||
|
||
location / { | ||
try_files $uri $uri/ @backend; | ||
} | ||
|
||
location @backend { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto https; | ||
proxy_set_header X-Forwarded-Ssl on; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
proxy_pass http://backend; | ||
proxy_cookie_path / "/; HTTPOnly; Secure"; | ||
} | ||
|
||
# WebSocket configuration | ||
location /socket.io/ { | ||
proxy_pass http://backend; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $host; | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.