CustomConfig is a tool that allows you to standardise and replicate the configuration of non-containerized components, like proxies and databases, for use in your Maestro application(s).
This guide will introduce you to the concept by showing you how to modify the configuration of an application’s Nginx reverse proxy.
We also have a more detailed guide to CustomConfig including which components are supported and Liquid templating language.
What you’ll need
Before you start, please check you have the following:
- A Cloud 66 Account — If you don’t already have one, sign up for a Cloud 66 account. There is a free community plan and you’ll get full unlimited access to all products free for 14 days.
- An existing application set up in Maestro — To make the most of this tutorial you need to have an app already set up in Maestro. Follow our Getting Started guide if you’re not sure how to do this.
This tutorial uses the simple visit counter application we've supplied on Github as a working example.
Editing a template
In this example we’re going to modify the standard Nginx configuration template to increase the number of worker connections your reverse proxy will accept.
To access the Nginx template for your application:
- Open the application overview page from your Dashboard
- Click on Configuration files in the Application panel on the right of the screen
- Click on the NGINX tab at the top of the Configure Services
We will now use the built-in text editor to make our change to the template:
- Look for the worker_connections variable in the file. It should be right near the top - in the first 8 or 10 lines.
- Change the value of the variable from
- Click the green Preview button below the text editor
- Check the preview of the file to ensure your change has been made correctly
- Add a commit message
- Click Commit to Server
Applying configuration changes
Once you have committed your change, your new configuration file will be validated and then automatically applied to Nginx on your server(s).
This works very much like it would do if you updated it manually - it changes the file and then restarts the Nginx process to enable that new configuration.
This process takes place in the background and might take some time to complete depending on the number of servers used by your application and the nature of the configuration change.
Also, during the process, Maestro will update the contents of the CustomConfig git repository for this application. This feature allows you to edit your config files via a git client if you prefer.
Why do we need Preview?
The Preview step exists because CustomConfig files are dynamic - they use a templating language called Liquid that renders different versions of your configuration files depending on the logic encoded in the template. Preview shows you the output of that logic - in other words, the “final” configuration produced by the template.
Preview uses dummy data for some server variables (like the number of cores or the path for different binaries). Refer to our documentation to learn about how the size of your instance affects the number of Nginx workers on your server.
Testing your change
The best way to check whether your change has been applied to your server is to access it directly using SSH. Cloud 66 Toolbelt is the quickest way to do this.
Once you are connected to your server, you can
cat your config file. The command will look something like this:
cat /etc/nginx/cloud66_nginx.conf and it will print the config file to screen for you to check.