Skip to main content

Docker Testing

danger

If you notice any CORS errors, please send a message on slack so it can be resolved.

warning

Ensure you successfully run and test your changes on Docker before merging into main

The steps outlined below will ensure that you can test your changes locally on your development machine without having to merge into main and deploy to dev environment before you test work done. The docker environment is as close to dev and production as possible. The database is a dump of dev. It is also possible to test changes currently deployed to production using the docker setup below.

warning

Testing code currently merged to prod and deployed to production will not use production database, but a local Docker instance/copy of development database.

Ports used by applications

Ensure that no other application, container or service is using any of these ports!

ServicePort
Web App3000
API8000
Workflow8001
Redis16379
Mysql13306
BookADoc Marketing3001
Alethian Marketing3002
Biz App3003
Jobs Are Disabled!

Background Jobs are currently disabled! To enable set the DISABLE_JOB variable in .env.docker.api file to false. ONLY SET IF YOU KNOW WHAT YOU ARE DOING!!!

Steps

  1. Ensure Docker or Docker Desktop

  2. Clone the repository:

    git clone https://github.com/Alethian-corp/docker-testing-setup.git
  3. Navigate to the project directory:

    cd docker-testing-setup
  4. Edit the .env file and specify either:

    a) remote GitHub repo#branch eg: https://github.com/Alethian-corp/new-webapp.git#main

    b) your local repo directory or folder path eg: /path/to/your/local/repo/for/new-webapp

  5. Ensure you have setup GitHub Personal Access Tokens. Follow instructions here how to setup PAT

  6. Copy the PAT and export into your profile or environment.

    i. For Windows, in a command console type setx GITHUB_TOKEN value_of_your_pat_from_step_1

    ii. For Linux or macOS, in a command terminal type echo "GITHUB_TOKEN=value_of_your_pat_from_step_1" >> ~/.bashrc. If you are not using bash shell, replace with your shell's profile file name.

    iii. Restart your terminal and ensure that the value of GITHUB_TOKEN exists and its set to your PAT when you type export .

  7. In your OS hosts file add the following entries, one per line:

    hostname
    127.0.0.1api
    127.0.0.1workflow
    127.0.0.1webapp
    127.0.0.1mysql
    127.0.0.1redis
    127.0.0.1bizapp
    127.0.0.1mailhog
    Separate the two parts of each line item using a tab. Eg: after api, press the tab key on your keyboard before typing 127.0.0.1.

    On Windows, the hosts file is c:\windows\system32\drivers\etc\hosts; while no Linux and MacOS its in /etc/hosts. After making the edit, ensure you can ping each name: eg ping api

  8. Start the docker build process:

    docker-compose build

    Check if any errors. If network related errors, just re-run the command

  9. Run the application in docker:

    docker-compose up 

    Check and ensure no errors and all services are running.

  10. Open http://localhost:3000 with your browser to see the result. You should be able to login with your current user details on dev.

  11. To view emails sent if using the local email server, open MailHog Viewer. You can view more details here

tip

Post any errors to slack for assistance.