Docker Testing
If you notice any CORS errors, please send a message on slack so it can be resolved.
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.
Testing code currently merged to prod and deployed to production will not use production database, but a local Docker instance/copy
of development database.
Ensure that no other application, container or service is using any of these ports!
| Service | Port |
|---|---|
| Web App | 3000 |
| API | 8000 |
| Workflow | 8001 |
| Redis | 16379 |
| Mysql | 13306 |
| BookADoc Marketing | 3001 |
| Alethian Marketing | 3002 |
| Biz App | 3003 |
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
-
Ensure Docker or Docker Desktop
-
Clone the repository:
git clone https://github.com/Alethian-corp/docker-testing-setup.git -
Navigate to the project directory:
cd docker-testing-setup -
Edit the
.envfile 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
-
Ensure you have setup GitHub Personal Access Tokens. Follow instructions here how to setup PAT
-
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_1ii. 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_TOKENexists and its set to your PAT when you type export . -
In your OS hosts file add the following entries, one per line:
host name 127.0.0.1 api 127.0.0.1 workflow 127.0.0.1 webapp 127.0.0.1 mysql 127.0.0.1 redis 127.0.0.1 bizapp 127.0.0.1 mailhog 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
-
Start the docker build process:
docker-compose buildCheck if any errors. If network related errors, just re-run the command
-
Run the application in docker:
docker-compose upCheck and ensure no errors and all services are running.
-
Open http://localhost:3000 with your browser to see the result. You should be able to login with your current user details on
dev. -
To view emails sent if using the local email server, open MailHog Viewer. You can view more details here
Post any errors to slack for assistance.