Skip to content

Commit

Permalink
update dockerfiles, add nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
tdjsnelling committed Feb 21, 2024
1 parent e2ba154 commit 5e1e955
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ The sqtracker client service provides the modern, responsive web interface that

The HTTP proxy allows the client, API, and BitTorrent tracker to all be accessible via a single endpoint.

Traefik is recommended and is configured by default. An Nginx config file is also provided for those that prefer it and the `docker-compose.yml` file contains an Nginx block that can be enabled.

### Deploying with Docker compose

The sqtracker platform is designed to be deployed via Docker. Once a configuration file is created, deploying is as simple as running `docker compose up -d` at the root of the project.
Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:16
ENV NODE_ENV=production
ENV SENTRY_DSN="https://[email protected]/4504645996576768"
LABEL org.opencontainers.image.source=https://github.com/tdjsnelling/sqtracker
Expand Down
8 changes: 0 additions & 8 deletions api/src/utils/validateConfig.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import * as yup from "yup";
import en from "@sqtracker/client/locales/en.json";
import es from "@sqtracker/client/locales/es.json";
import it from "@sqtracker/client/locales/it.json";
import ru from "@sqtracker/client/locales/ru.json";
import de from "@sqtracker/client/locales/de.json";
import zh from "@sqtracker/client/locales/zh.json";
import eo from "@sqtracker/client/locales/eo.json";
import fr from "@sqtracker/client/locales/fr.json";

const httpRegex = /http(s)?:\/\/.*/;
const mongoRegex = /mongodb:\/\/.*/;
Expand Down
2 changes: 1 addition & 1 deletion client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine AS builder
FROM node:16 AS builder
ARG SENTRY_AUTH_TOKEN
ENV NODE_ENV=production
ENV SENTRY_ORG=tdjsnelling
Expand Down
10 changes: 8 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ services:
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- ./traefik.yml:/config/traefik.yml
# nginx:
# image: "nginx:latest"
# container_name: "sq_nginx"
# restart: always
# ports:
# - "80:80"
# volumes:
# - ./nginx.conf:/etc/nginx/nginx.conf
database:
container_name: sq_mongodb
image: mongo:6.0
ports:
- "127.0.0.1:27017:27017"
volumes:
- ./data:/data/db
api:
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- ./letsencrypt:/letsencrypt
- ./traefik.yml:/config/traefik.yml
# nginx:
# image: "nginx:latest"
# container_name: "sq_nginx"
# restart: always
# ports:
# - "80:80"
# volumes:
# - ./nginx.conf:/etc/nginx/nginx.conf
database:
container_name: sq_mongodb
image: mongo:6.0
Expand Down
36 changes: 36 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
events {}

http {
server {
listen 80;
resolver 127.0.0.11;

location / {
proxy_pass http://sq_client:3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}

location /api/ {
rewrite /api/(.*) /$1 break;
proxy_pass http://sq_api:3001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}

location /sq/ {
proxy_pass http://sq_api:3001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
}

0 comments on commit 5e1e955

Please sign in to comment.