This App is made for training and is not secure. Usually the docker containers are connected through its own network, but I couldn't get it to work for me, so this version is connected with external ports, which can all be public.
The shitchat-client is the only container with a port exposed, and is connected to the other containers (shitchat-api and shitchat-mongodb) though a docker-network.
Download:
git clone <source>.git
GOTO DIR:
cd shitchat
MongoDB Settings:
mongodb:
#ports:
# - "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=mongodb_admin_username
- MONGO_INITDB_ROOT_PASSWORD=mongodb_admin_password
Chat API settings:
DB_HOST - is the mongodb-server
api:
#ports:
# - "3000:3000"
environment:
- PORT=3000
- DB_USERNAME=mongodb_admin_username
- DB_PASSWORD=mongodb_admin_password
- DB_NAME=shitchat
- DB_HOST=mongodb:27017
Client settings:
EXTERNAL_API_URI - is the api-server
client:
ports:
- "4000:4000"
environment:
- PORT=4000
- EXTERNAL_API_URI=http://api:3000
PORT=3000
DB_USERNAME=mongodb_admin_username
DB_PASSWORD=mongodb_admin_password
DB_NAME=shitchat
DB_HOST=mongodb:27017
PORT=4000
EXTERNAL_API_URI=http://api:3000
import dotenv from 'dotenv';
dotenv.config();
export const dbDetails = {
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
host: process.env.DB_HOST,
database: process.env.DB_NAME
};
write a secret word or sentence used for encryption in this file
Install docker and then run app.
sudo docker-compose up --build