This is an opinioniated project setup guide which asssumes you will be using the provided devcontainer.
Once you have installed the required software listed above you should be ready to open the project.
- Clone the project
- Open the project using VS Code
- At the bottom left of your VS Code window there will be an icon with 2 arrows point at each other. Click on that.
- In the popup, select
Reopen in Container
. - This will reopen the project inside of the devcontainer defined here.
- Create a
secrets
folder - Create a file called
.env
insecrets
- Insert the following example secrets into the
secrets/.env
file:MYSQL_HOST=database MYSQL_USER=test MYSQL_PASSWORD=example MYSQL_DATABASE=contact_manager
- Run the following to create the JWT RS256 encryption keys:
ssh-keygen -t rsa -b 4096 -m PEM -f secrets/jwt_encryption_key.pem openssl rsa -in secrets/jwt_encryption_key.pem -pubout -outform PEM -out secrets/jwt_encryption_key.pem.pub
docker compose up --build
If you are in an active docker compose session in your terminal, you can press CTRL+C
.
If it is running in the background you can run the following:
docker compose down
If you make a change to the init.sql
file, and want to test it end-to-end, you can delete the databse by running the following:
sudo rm -rf .cache
In your VS Code window, press F1
and select View: Toggle Ports
. This will open the port fowarding window.
Next, port forward port 80
by selecting Add Port
. Under Forwarded Address
it will give you an address to access the website.
After starting the server and port-forwarding the website in the previous section, you can open the Swagger UI by opening http://YOUR_FORWARDED_ADDRESS/swagger-ui/.
In your VS Code window, press F1
and select View: Toggle Ports
. This will open the port fowarding window.
Port forward port 8081
by selecting Add Port
. Under Forwarded Address
it will give you an address to access the website.
In PHPMyAdmin, leave the Server
field blank, and enter the username and password that you set in the .env
file.
Use the username, password, and database name provided in the .env
file to login. If you would like to use the mysql client you can do the following (replace YOUR_USER
with the user in your .env
):
docker run -it --network contact-manager_default --rm mysql mysql -hdatabase -uYOUR_USER -p
Port forward port 3306
by selecting Add Port
. Under Forwarded Address
it will give you an address to access the database.