In this section, we will migrate our current deployment to Portainer so that we can fully manage it inside Portainer later on. You can view the full code for the configuration here. To migrate our app, let’s follow these steps:
Update Docker Compose
In Portainer, we can set up the environment in their dashboard. However, we need to make some adjustments, such as changing the file name of .env.prod
to stack.env
.
Next, we need to change how we mount the create_tables.sql
. In our current implementation, we cannot directly mount the file; Docker will treat the create_tables.sql
as a folder instead of a file. Therefore, we need to use a new Docker volume to mount the file.
Delete Existing Container
Moving on to the next part, we will delete our existing Docker container and Docker volumes.
Create New Stack
The next step is to create a new stack for our project. To do so, open the Stacks
section in the dashboard and click the Add stack
button. Then, add the GitHub repository URL, branch name, and the Docker Compose file.
The following step is to add the environment variables and click Deploy the stack
to finish the configuration.
After completing the deployment, we can now have total control over our stack.
We can also check our API endpoint to ensure that everything is working as before.
Top comments (0)