Compare commits

...

9 Commits

Author SHA1 Message Date
Kayne Ruse 7ddef6ed1b Added DB_QUIET as an option 2021-03-10 23:57:27 +11:00
Kayne Ruse 4581f0376a Fixed crash when no password provided on account deletion 2021-03-10 23:43:57 +11:00
Kayne Ruse da8bba93eb Finally playing nice together 2021-03-07 15:34:04 +11:00
Kayne Ruse ddc07e4605 Irritating 2021-03-07 14:45:05 +11:00
Kayne Ruse 29ca934b93 Oh, come on 2021-03-07 14:21:12 +11:00
Kayne Ruse 0dd1717ff6 Minor name tweak 2021-03-07 14:14:13 +11:00
Kayne Ruse a23fb81570 Quick config fix 2021-03-07 14:07:48 +11:00
Kayne Ruse 83af2b1395 Tweaked docker-compose 2021-03-07 13:52:51 +11:00
Kayne Ruse b08e099b1e Whoops, forgot dockerfile for docker hub 2021-03-07 09:06:53 +11:00
6 changed files with 19 additions and 11 deletions
-1
View File
@@ -106,6 +106,5 @@ dist
# Docker generated files and folders # Docker generated files and folders
letsencrypt/ letsencrypt/
mysql/ mysql/
Dockerfile
docker-compose.yml docker-compose.yml
startup.sql startup.sql
+10
View File
@@ -0,0 +1,10 @@
FROM node:15
WORKDIR "/app"
COPY package*.json ./
RUN npm install --production
COPY . /app
EXPOSE 3200
USER node
ENTRYPOINT ["bash", "-c"]
CMD ["sleep 10 && npm start"]
+1 -3
View File
@@ -4,9 +4,7 @@ An API centric auth server. Uses Sequelize and mariaDB by default.
# Setup # Setup
TODO: Dockerize this project There are multiple ways to run this app - it can run on it's own via `npm start` (for production) or `npm run dev` (for development). it can also run inside docker using `docker-compose up --build` - run `node configure-script.js` to generate docker-compose.yml.
TODO: Write setup instructions, once dockerized
# API # API
+4 -3
View File
@@ -54,7 +54,7 @@ const question = (prompt, def = null) => {
version: '3' version: '3'
services: services:
app: ${appName}:
build: build:
context: . context: .
ports: ports:
@@ -98,7 +98,9 @@ services:
- app-network - app-network
volumes: volumes:
- ./mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
traefik: - ./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro
traefik_${appName}:
container_name: ${appName}_traefik
image: "traefik:v2.4" image: "traefik:v2.4"
container_name: "traefik" container_name: "traefik"
command: command:
@@ -116,7 +118,6 @@ services:
volumes: volumes:
- "./letsencrypt:/letsencrypt" - "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro" - "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro"
networks: networks:
- app-network - app-network
networks: networks:
+1 -1
View File
@@ -17,7 +17,7 @@ const route = async (req, res) => {
//compare the user's password //compare the user's password
const compare = utils.promisify(bcrypt.compare); const compare = utils.promisify(bcrypt.compare);
const match = await compare(req.body.password, account.hash); const match = await compare(req.body.password || '', account.hash);
if (!match) { if (!match) {
return res.status(401).send('incorrect password'); return res.status(401).send('incorrect password');
+1 -1
View File
@@ -4,7 +4,7 @@ const sequelize = new Sequelize(process.env.DB_DATABASE, process.env.DB_USERNAME
host: process.env.DB_HOSTNAME, host: process.env.DB_HOSTNAME,
dialect: 'mariadb', dialect: 'mariadb',
timezone: process.env.DB_TIMEZONE, timezone: process.env.DB_TIMEZONE,
logging: false logging: !!process.env.DB_QUIET
}); });
sequelize.sync(); sequelize.sync();