Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
electron271 committed Nov 24, 2024
0 parents commit 2ffd54b
Show file tree
Hide file tree
Showing 12 changed files with 1,639 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*
!src/
!prisma/
!.env
!package.json
!package-lock.json
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# comment out database url if you are using docker
#DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
DISCORD_TOKEN="dontsharethis!"
DISCORD_CLIENT_ID="123456789012345678"
DISCORD_SERVER_ID="123456789012345678" # this bot is only designed to work in one server
DISCORD_CHANNEL_ID="123456789012345678" # this bot is only designed to work in one channel
ACTIVITY="s$help for commands"
PREFIX="s$"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docker-compose.yml
data/graph.gexf
postgres-data/
.env
node_modules/
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:22-alpine
WORKDIR /app
COPY package.json package.json
COPY package-lock.json package-lock.json

RUN npm install

# copy src/, prisma/, .env
COPY src/ src/
COPY prisma/ prisma/
COPY .env .env

RUN npx prisma generate
CMD ["npm", "run", "bot"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# stats.atl.dev backend
right now some things may be hard coded, please change them to not be hard coded if you know how
39 changes: 39 additions & 0 deletions docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
services:
db:
image: postgres
restart: unless-stopped
ports:
- 5432:5432 # change ports if you have other postgres instances running
volumes:
- ./postgres-data/:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=slightlysecurepassword123 # change this if you are stupid enough to use this app in production
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
- PGDATA=/var/lib/postgresql/data/pgdata
adminer: # you should probably remove this in production
image: adminer
restart: unless-stopped
ports:
- 8081:8080
nginx:
image: nginx
restart: unless-stopped
ports:
- 8080:8080 # this is a really common port and should be changed most likely to something else
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./public/:/usr/share/nginx/html/public
- ./data/:/usr/share/nginx/html/data
app:
build: .
restart: unless-stopped
ports:
- 8000:8000 # in busy environments you might want to change this if port 8000 is already in use
volumes:
- ./data/:/app/data
depends_on:
- db
- nginx
environment:
- DATABASE_URL=postgresql://postgres:slightlysecurepassword123@db:5432/postgres
18 changes: 18 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
events {}

http {
server {
root /usr/share/nginx/html;
listen 8080;

# reverse proxy to port 8000
location / {
proxy_pass http://app:8000;
}

# Serve static files in /data
location /data {
alias /usr/share/nginx/html/data;
}
}
}
Loading

0 comments on commit 2ffd54b

Please sign in to comment.