1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-14 06:32:36 +01:00

Merge branch 'slowcord' of github.com:MaddyUnderStars/fosscord-server into slowcord

This commit is contained in:
Madeline 2022-07-23 20:56:33 +10:00
commit a66cf99994
5 changed files with 16 additions and 53 deletions

View File

@ -1 +0,0 @@
MONGO_URL=mongodb://db:27017/fosscord?readPreference=secondaryPreferred

View File

@ -1,2 +0,0 @@
node_modules/
db/

View File

@ -1,8 +1,6 @@
FROM node:alpine FROM node:alpine
# env vars # env vars
ENV WORK_DIR="/srv/fosscord-server"
ENV DEV_MODE=0
ENV HTTP_PORT=3001 ENV HTTP_PORT=3001
ENV WS_PORT=3002 ENV WS_PORT=3002
ENV CDN_PORT=3003 ENV CDN_PORT=3003
@ -13,28 +11,12 @@ ENV ADMIN_PORT=3005
EXPOSE ${HTTP_PORT}/tcp ${WS_PORT}/tcp ${CDN_PORT}/tcp ${RTC_PORT}/tcp ${ADMIN_PORT}/tcp EXPOSE ${HTTP_PORT}/tcp ${WS_PORT}/tcp ${CDN_PORT}/tcp ${RTC_PORT}/tcp ${ADMIN_PORT}/tcp
# install required apps # install required apps
RUN apk add --no-cache --update git python2 py-pip make build-base RUN apk add --no-cache --update git python3 py-pip make build-base
RUN ln -s /usr/bin/python3 /usr/bin/python
# optionl: packages for debugging/development # Run as non-root user
RUN apk add --no-cache sqlite # RUN adduser -D fosscord
# USER fosscord
# download fosscord-server WORKDIR /srv/fosscord-server/bundle
WORKDIR $WORK_DIR/src ENTRYPOINT ["npm", "run", "start:bundle"]
RUN git clone https://github.com/fosscord/fosscord-server.git .
# setup and run
WORKDIR $WORK_DIR/src/bundle
RUN npm run setup
RUN npm install @yukikaze-bot/erlpack
# RUN npm install mysql --save
# create update script
RUN printf '#!/bin/sh\n\ngit -C $WORK_DIR/src/ checkout master\ngit -C $WORK_DIR/src/ reset --hard HEAD\ngit -C $WORK_DIR/src/ pull\ncd $WORK_DIR/src/bundle/\nnpm run setup\n' > $WORK_DIR/update.sh
RUN chmod +x $WORK_DIR/update.sh
# configure entrypoint file
RUN printf '#!/bin/sh\n\nDEV_MODE=${DEV_MODE:-0}\n\nif [ "$DEV_MODE" -eq 1 ]; then\n tail -f /dev/null\nelse\n cd $WORK_DIR/src/bundle/\n npm run start:bundle\nfi\n' > $WORK_DIR/entrypoint.sh
RUN chmod +x $WORK_DIR/entrypoint.sh
WORKDIR $WORK_DIR
ENTRYPOINT ["./entrypoint.sh"]

6
docker-compose.cfg.yml Normal file
View File

@ -0,0 +1,6 @@
version: '3.9'
services:
fosscord:
entrypoint: [ "npm", "run", "setup" ]

View File

@ -1,46 +1,24 @@
version: '3.8' version: '3.9'
services: services:
fosscord: fosscord:
container_name: fosscord container_name: fosscord
image: fosscord image: fosscord
restart: on-failure:5 restart: on-failure:5
# depends_on: mariadb
build: . build: .
ports: ports:
- '3001-3005:3001-3005' - '3001-3005:3001-3005'
volumes: volumes:
# - ./data/:${WORK_DIR:-/srv/fosscord-server}/data/ - ./:/srv/fosscord-server/
- data:${WORK_DIR:-/srv/fosscord-server}/
environment: environment:
WORK_DIR: ${WORK_DIR:-/srv/fosscord-server}
DEV_MODE: ${DEV_MODE:-0}
THREADS: ${THREADS:-1} THREADS: ${THREADS:-1}
DATABASE: ${DATABASE:-../../data/database.db}
STORAGE_LOCATION: ${STORAGE_LOCATION:-../../data/files/}
HTTP_PORT: 3001 HTTP_PORT: 3001
WS_PORT: 3002 WS_PORT: 3002
CDN_PORT: 3003 CDN_PORT: 3003
RTC_PORT: 3004 RTC_PORT: 3004
ADMIN_PORT: 3005 ADMIN_PORT: 3005
# mariadb:
# image: mariadb:latest
# restart: on-failure:5
# environment:
# MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-secr3tpassw0rd}
# MYSQL_DATABASE: ${MYSQL_DATABASE:-fosscord}
# MYSQL_USER: ${MYSQL_USER:-fosscord}
# MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password1}
# networks:
# - default
# volumes:
# - mariadb:/var/lib/mysql
volumes:
data:
# mariadb:
networks: networks:
default: default:
name: fosscord name: fosscord