feat: add docker compose file

This commit is contained in:
alireza
2023-11-07 20:44:21 +03:30
parent 064d642b7e
commit 9ce98b6bee
6 changed files with 70 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
const mongoose = require('mongoose');
// mongodb database connection string. change it as per your needs. here "mydb" is the name of the database. You don't need to create DB from mongodb terminal. mongoose create the db automatically.
mongoose.connect('mongodb://localhost:27017/arakrail', {
mongoose.connect(`mongodb://${process.env.MONGO_HOST}:27017/arakrail`, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
+2 -1
View File
@@ -2,7 +2,7 @@ const express = require('express')
const db = require('./db')
const fileUpload = require('express-fileupload')
const config = require('./config')
require('dotenv').config({path: __dirname+'/.env'})
// Create express instnace
const app = express()
@@ -11,6 +11,7 @@ app.use(express.json())
app.use(express.urlencoded({extended: true}))
app.use(fileUpload())
// Require & Import API routes
const Private = require('./routes/private')
const Public = require('./routes/public')
+42
View File
@@ -0,0 +1,42 @@
version: "3.9"
services:
app:
image: node:14-alpine
working_dir: /app
command: sh -c "npm i && npm rebuild node-sass && npm run build && npm run start"
volumes:
- .:/app
ports:
- "${PORT}:${PORT}"
depends_on:
- mongo
restart: on-failure
mongo:
image: mongo:4.4.25
restart: always
ports:
- "27017:27017"
volumes:
- arakrail-data:/etc/mongo
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS}
# mongo-express:
# image: mongo-express
# restart: always
# ports:
# - "8081:8081"
# environment:
# ME_CONFIG_BASICAUTH_USERNAME: ${MONGO_PANEL_USER}
# ME_CONFIG_BASICAUTH_PASSWORD: ${MONGO_PANEL_PASS}
# ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_USER}
# ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_PASS}
# ME_CONFIG_MONGODB_URL: "mongodb://${MONGO_PANEL_USER}:${MONGO_PANEL_PASS}@mongo:27017/"
# depends_on:
# - mongo
volumes:
arakrail-data:
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
apps: [
{
name: 'arakrail',
exec_mode: 'cluster',
instances: 'max', // Or a number of instances
script: './node_modules/nuxt/bin/nuxt.js',
args: 'start'
}
]
}
+13 -3
View File
@@ -1523,6 +1523,11 @@
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-2.0.4.tgz",
"integrity": "sha512-G9pEH1UUMxShy6syWk01VQSRVs3CDWtlxtZu7A+NyqjxaCA4gSlWAKDBx6QiUEKezqS8+DUlXLI14Fp05Hmpwg=="
},
"dotenv": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
"integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g=="
}
}
},
@@ -1740,6 +1745,11 @@
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-2.0.4.tgz",
"integrity": "sha512-G9pEH1UUMxShy6syWk01VQSRVs3CDWtlxtZu7A+NyqjxaCA4gSlWAKDBx6QiUEKezqS8+DUlXLI14Fp05Hmpwg=="
},
"dotenv": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
"integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g=="
}
}
},
@@ -4699,9 +4709,9 @@
}
},
"dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ=="
},
"duplexer": {
"version": "0.1.2",
+1
View File
@@ -18,6 +18,7 @@
"ckeditor4-vue": "^1.2.0",
"core-js": "^3.6.5",
"dateformat": "^4.0.0",
"dotenv": "^16.3.1",
"element-ui": "^2.13.2",
"express": "^4.17.1",
"express-fileupload": "^1.2.0",