frappe_docker/README.md
2025-04-01 09:51:05 +02:00

5.7 KiB

RAFNAV Docker Setup & Usage

Development

!! You need to be connected to WSL before proceeding

Pre-requisites

To get started, you must have set up an IT Workspace environment.

Introduction

You will be working in the ./development folder a.k.a. a dev workspace. Follow the steps below to set up the workspace.

Workspace Setup

  1. Clone the Repo into your working directory
git clone https://github.com/cronos-capital/RAFNAV-Docker.git
cd RAFNAV-Docker
  1. Create the devcontainer and VsCode configuration from the templates provided
cp -R devcontainer-example .devcontainer
cp -R development/vscode-example development/.vscode

Build the Docker Image

Run the following command in your working directory

docker build -t rafnav_bench:latest ./images/rafnav_bench

You may change the tag to a more relevant naming convention. However, you need to change the image used for development in the correct docker-compose file: ./.devcontainer/docker-compose.yml

Container Initialization

We will be attaching a VS Code window to the docker container workspace. This requires the dev containers extension

  1. Open the RAFNAV-Docker folder with Vs Code.
  2. Open the command pallet with ctrl + shift + p or View->Command Pallet
  3. Run the command dev containers: Reopen in container
  4. Wait for the container to warm up...

GitHub Login (GitHub CLI)

  • Make sure you have git and Github CLI installed on windows
  • Log in to GitHub from VsCode to sync your github credentials with GitHub

RAFNAV Installation

Development Branch Apps Install

  frap-install -j apps-development.json -v

Prod Apps Install

 frap-install -j apps-prod.json -v

Note: For additional args and configs run frap-install --help first.

  1. cd into Rafnav's development bench. An alias has already been assigned. Run the following command:
go-rafnav_bench
  1. Now you are able to start development on RAFNAV with all the dependencies and the correct environment set-up.

Default Credentials

MariaDB Root Password: 123

Unless changed in the docker or docker-compose file

First site's Administrator password: admin

Unless changed in the docker or docker-compose file

Deployment

Apps List

  1. Specify a list of apps in a JSON file called 'apps.json'
[
  {
    "url": "https://{{PAT}}@github.com/cronos-capital/rafnav_core.git",
    "branch": "main"
  },
  {
    "url": "https://{{PAT}}@github.com/cronos-capital/matter_management.git",
    "branch": "main"
  },
  {
    "url": "https://{{PAT}}@github.com/cronos-capital/raf_finance.git",
    "branch": "main"
  },
  {
    "url": "https://{{PAT}}@github.com/cronos-capital/filing.git",
    "branch": "main"
  },
  {
    "url": "https://{{PAT}}@github.com/cronos-capital/documentation.git",
    "branch": "main"
  }
]

Note: {{PAT}} replace with your personal access token from GitHub

  1. Generate a Base 64 shell variable of the apps list. This will be passed as a build argument for the docker image later
export APPS_JSON_BASE64=$(base64 -w 0 apps.json)

Image Build

Build the production version of the image using

docker build --build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64 -t rafnav/rafnav_bench:prod --file=images/production/Containerfile .

Publish Image

Publish the newly built docker image to docker hub using your PAT from Docker Hub

  1. Log in to Docker if not already
docker login -u [username]
  1. At the password prompt, paste your PAT
  2. Push the image using the following command:
docker push rafnav/rafnav_bench:prod

Common Issues

1. Access denied for user [db user]@[host] (using password: YES)")

  1. Attach a shell to the mariadb container
docker exec -it rafnav-db-1 bash
  1. Log in as root user
mariadb -p

At the prompt, enter the db root password that can be found in the compose or project env file

  1. In a new terminal exec into the backend container
docker exec -it rafnav-backend-1 bash
  1. Show the db info from the site's config file
cat sites/[sitename]/site_config.json
  1. Create the a new DB user
CREATE USER [db_name]@[host] IDENTIFIED BY [db_password];
  1. Grant all privilges to the correct db for the newly created user
GRANT ALL PRIVILEGES ON [db_name].* TO [db_name]@[host] IDENTIFIED BY [db_password];

Keep the .* after the db_name

host= IP address from the error message
db_name= DB name contained in the config file
db_password= Password from the config file

Resources

Production

Development