mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 17:26:36 +00:00
remove nginx and pm2
This commit is contained in:
@@ -94,22 +94,18 @@ FROM base AS production
|
|||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
# Install PM2
|
|
||||||
RUN npm install -g pm2
|
|
||||||
# Copy ecosystem.config.js
|
|
||||||
COPY ecosystem.config.js .
|
|
||||||
|
|
||||||
RUN apk add --no-cache nginx
|
|
||||||
|
|
||||||
COPY nginx/default-stand-alone-docker.conf /etc/nginx/nginx.conf
|
|
||||||
|
|
||||||
COPY --from=backend-runner /app /backend
|
COPY --from=backend-runner /app /backend
|
||||||
|
|
||||||
COPY --from=frontend-runner /app ./backend/frontend-build
|
COPY --from=frontend-runner /app ./backend/frontend-build
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
ENV PORT 80
|
||||||
ENV HTTPS_ENABLED false
|
ENV HTTPS_ENABLED false
|
||||||
|
ENV NODE_ENV production
|
||||||
|
|
||||||
CMD ["pm2-runtime", "start", "ecosystem.config.js"]
|
WORKDIR /backend
|
||||||
|
|
||||||
|
CMD ["node", "build/index.js"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -90,8 +90,6 @@ const SmeeClient = require("smee-client"); // eslint-disable-line
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import next from "next";
|
import next from "next";
|
||||||
|
|
||||||
const dir = path.join(__dirname, "../frontend-build");
|
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
await setup();
|
await setup();
|
||||||
|
|
||||||
@@ -213,12 +211,14 @@ const main = async () => {
|
|||||||
// server status
|
// server status
|
||||||
app.use("/api", healthCheck);
|
app.use("/api", healthCheck);
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV == "production") {
|
||||||
|
const dir = path.join(__dirname, "../frontend-build");
|
||||||
process.chdir(dir);
|
process.chdir(dir);
|
||||||
const nextApp = next({
|
const nextApp = next({
|
||||||
dev: false,
|
dev: false,
|
||||||
dir
|
dir
|
||||||
});
|
});
|
||||||
|
|
||||||
const nextHandler = nextApp.getRequestHandler();
|
const nextHandler = nextApp.getRequestHandler();
|
||||||
await nextApp.prepare();
|
await nextApp.prepare();
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
apps: [
|
|
||||||
{
|
|
||||||
name: "backend",
|
|
||||||
script: "npm",
|
|
||||||
args: "run start",
|
|
||||||
cwd: "./backend",
|
|
||||||
instances: 1,
|
|
||||||
exec_mode: "fork",
|
|
||||||
autorestart: true,
|
|
||||||
watch: false,
|
|
||||||
max_memory_restart: "500M",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "nginx",
|
|
||||||
script: "nginx",
|
|
||||||
args: "-g 'daemon off;'",
|
|
||||||
exec_interpreter: "none",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
events {}
|
|
||||||
http {
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
|
|
||||||
location /api {
|
|
||||||
proxy_set_header X-Real-RIP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header X-NginX-Proxy true;
|
|
||||||
|
|
||||||
proxy_pass http://localhost:4000; # for backend
|
|
||||||
proxy_redirect off;
|
|
||||||
|
|
||||||
# proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
|
|
||||||
proxy_cookie_path / "/; HttpOnly; SameSite=strict";
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
|
|
||||||
proxy_set_header X-Real-RIP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header X-NginX-Proxy true;
|
|
||||||
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
|
|
||||||
proxy_pass http://localhost:3000; # for frontend
|
|
||||||
proxy_redirect off;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user