For the sake of this example, we present how to deploy gotenberg, a powerful pdf generator.
Deploying Gotenberg for pdf generation
Create a blank service
On the webcapsule, go to your project and to the version page. Then add a custom service. This will create a blank git repository where you will be able to add the Dockerfile.
Step 1: Click on the "+" button to add a new service to your stack
Step 2: Choose the custom technology
Step 3: Choose a name for your service
Here we decide to name the service "gotenberg"
Step 4: validate the creation of the service
This will create a new git repo and a new service in the stack. No deployment will be made and your service is not live until you add a docker (see the next step)
Add a Dockerfile to your git repository
A new git repository has been added to your organization. You can access it by clicking the "git" icon on the webcapsule interface.
- Go to your git repository
- Go to the staging branch (by default, it is
WBCE_staging
) - Add a
Dockerfile
at the root of the project - Fulfill the content of your Dockerfile with this :
FROM gotenberg/gotenberg:8.4.0
The 8.4.0
was the latest version of Gotenberg on the 2024/04/16.
You can customize and update this content to your need. We strongly recommand being precise on the version number. When you want to change the version number, just change your Dockerfile and redeploy the service with the webcapsule.
Change the listening port in Infisical
By default, webcapsule assume your docker will expose and listen with the port number 80
.
Gotenberg uses 3000
as the port number.
As a consequence, before deploying, you have to change this setting in the config manager.
In infisical, go to the path :
name of your project > env "staging" > name of your service > input > values
Then set the value of the variable PORT
to 3000 and save.
Deploy the service
Go to the "version" page in webcapsule, select the staging environment, go to the gotenberg service tab, click deploy on the last commit you made. This will create the gotenberg service.