Skip to content

akdasa-studios/shlokas-server

Repository files navigation

This repository organizes several docker containers to run the application:

  1. Database – database for storing user data
  2. Authentication – authentication server for user login
  3. Landing – landing page for the application
  4. Balancer – load balancer for the application
  5. Balancer – content server for the application
  6. Admin – admin server for the application

Development

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

GitHub Personal Access Token

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

‼️ Note: Without token you won't be able to build the images and you will get the following error:

#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.

Production

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

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",
    }
  }
}

Environment Variables

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

Updating

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages