Service templates are predefined normal docker-compose files + a bit of magic.
The bit of Magic
To be able to predefine values, like usernames, passwords, fqdns, predefined values for bind (file) mounts etc, the docker-compose files are extended with a few keywords.
More magic coming soon 🪄
In the environment option, you can do the following.
Let’s use APPWRITE as an example with a generate UUID of vgsco4o and with a wildcard domain of http://example.com.
FQDN
This will generate a FQDN for appwrite service.
If you use the same variable on another service, it will generate the same FQDN for you.
You sometimes need the same domain, but with different paths.
You can reuse this generated FQDN anywhere.
You sometimes need the same domain, but with different ports. This will tell the proxy which port to proxy to which domain.
In the example, we combine paths and ports.
This could be used as a value as well. No default value allowed.
URL
This will generate an URL based on the FQDN you have defined.
Username
Example: $SERVICE_USER_APPWRITE
Generator: Str::random(16)
Password
Example: $SERVICE_PASSWORD_APPWRITE
Generator: Str::password(symbols: false)
You can also generate 64 bit long password.
Example: $SERVICE_PASSWORD_64_APPWRITE
Generator: Str::password(length: 64, symbols: false)
BASE64
This helper is NOT using base64 encoding, but it’s generating a random string.
Example: $SERVICE_BASE64_APPWRITE
Generator: Str::random(32)
If you wish to generate longer strings, you can use the following:
BASE64_64
Example: $SERVICE_BASE64_64_APPWRITE
Generator: Str::random(64)
BASE64_128
Example: $SERVICE_BASE64_128_APPWRITE
Generator: Str::random(128)
REALBASE64
This helper does use base64 encoding unlike the other base64 which just generates a random string.
Example: $SERVICE_REALBASE64_APPWRITE
Generator: base64_encode(Str::random(32));
If you wish to generate longer strings, you can use the following:
REALBASE64_64
Example: $SERVICE_REALBASE64_64_APPWRITE
Generator: base64_encode(Str::random(64));
REALBASE64_128
Example: $SERVICE_REALBASE64_128_APPWRITE
Generator: base64_encode(Str::random(128));
Storage
You can predefine storage normally in your compose file, but there are a few extra options that you can set to tell Coolify what to do with the storage.
Create an empty directory
Create a file with content
Here you can see how to add a file with content and a dynamic value that is coming from an environment variable.
You need to add extra metadata to the top of the docker-compose file, like:
- documentation link
- a slogan
- additional tags (for better searching)
- logo (local icon, could be svg, png, etc)
- port (always use the port which is the main entrypoint - like frontend - of the service)
Always add a port, because Caddy Proxy cannot determine the port of the
service automatically.
Example:
Add a new service
Official templates stored here. They are just normal docker-compose files with a bit of magic.
To add a new service you can either Generate your Service Template or easily test your templates with Docker Compose deployments inside Coolify. It uses the same process to parse, generate and deploy as the one-click services.
If you are done with tests and everything works, open a PR, that have the new <service>.yaml compose file under /templates/compose.
Generating Service Template
When adding a new Service you might want to find it in the list to verify the Metadata or just install it quickly.
Make sure your Coolify container is running through the spin up command, then open a new terminal and run the following command.
This will rebuild the template, now refresh the Services and your Service should show up.
Request a new service
If there is a service template you’d like to see:
- Search GitHub discussions here.
- If it has already been requested, upvote it. If not, create a new request.