This repository organizes several docker containers to run the application:
- Database – database for storing user data
- Authentication – authentication server for user login
- Landing – landing page for the application
- Balancer – load balancer for the application
- Balancer – content server for the application
- Admin – admin server for the application
Clone all the repositories related to the application. The following commands will clone all the repositories in the current directory:
gh search repos --owner akdasa-studios --match name shlokas --visibility public | while read -r repo _; do
gh repo clone "$repo" "$repo"
done
The GitHub Personal Access Token is required to pull the images from the GitHub Container Registry. You can create a token here. The token should have the packages:read
permission. After creating the token, you can set it as an environment variable. The following commands will build all the images and run the application:
export GITHUB_TOKEN=your_token
cd ./akdasa-studios/shlokas-server
./shlokas.build.sh dev
./shlokas.run.sh dev
#0 39.47 npm ERR! code E401
#0 39.47 npm ERR! 401 Unauthorized - GET https://npm.pkg.github.com/[OMITED] - unauthenticated: User cannot be authenticated with the token provided.
In production, all the images are pulled from the GitHub Container Registry. You can run the application using the following commands.
gh repo clone akdasa-studios/shlokas-server
cd ./shlokas-server
./shlokas.run.sh prod
Watchtower is a tool that automatically updates running docker containers. It is configured to run on the host machine and update the containers on the docker network. It requires an authentication token to access the docker registry. The token is stored in the config.json
file in the root directory of the project.
// config.json
{
"auths": {
"ghcr.io": {
// echo -n 'github_username:github_personal_token' | base64
"auth": "AUTH_STRING",
}
}
}
The following environment variables are used by the server. They are stored in the environment.env
file in the root directory of the project. You can override these values by creating an environment.local.env
file.
# Server settings: dev or prod
ENV=dev
# Database settings
COUCHDB_USER=dev
COUCHDB_PASSWORD=dev
COUCHDB_HOST=db
SHLOKAS_USERS_DB=users_shlokas
# Email settings for sending emails
[email protected]
SHLOKAS_EMAIL_PASSWORD=password
BALANCER_ENV=dev
All the containers are updated automatically by the watchtower. But if a new container was added, you need to update the docker-compose.yml
and cut the release. This will automatically update the repository on the server and the server will be restarted.