|
| 1 | +--- |
| 2 | +myst: |
| 3 | + html_meta: |
| 4 | + description: Configure your Hypernode server on Deploytime to rapidly test upgrades |
| 5 | + with service upgrades |
| 6 | + title: Configure Hypernode settings on Deployment |
| 7 | +--- |
| 8 | + |
| 9 | +# Configure Hypernode settings on Deployment |
| 10 | + |
| 11 | +Hypernode Deploy allows you to change configurations to the Hypernode server on-the-fly and on deploy time, this is extremely beneficial when doing a MySQL upgrade or Node.js versions controlled by your source version control. |
| 12 | + |
| 13 | +Here's a list of changes you can make to the Hypernode: |
| 14 | + |
| 15 | +- Hypernode Systemctl Configuration |
| 16 | +- Cron Configuration |
| 17 | +- Nginx vhost Configuration |
| 18 | +- Supervisor Configuration |
| 19 | +- Varnish Configuration |
| 20 | + |
| 21 | +## Hypernode Systemctl Configuration |
| 22 | + |
| 23 | +You can use Hypernode's systemctl utility to change crucial settings about the Hypernode server. This can also be configured in your deployments. More information about the systemctl utility can be found [here](../../hypernode-platform/tools/how-to-use-the-hypernode-systemctl-cli-tool.md). |
| 24 | + |
| 25 | +You can simply define these settings configurations by using this code in your `deploy.php` file: |
| 26 | + |
| 27 | +```php |
| 28 | +$configuration->setPlatformConfigurations([ |
| 29 | + new PlatformConfiguration\HypernodeSettingConfiguration('supervisor_enabled', 'True'), |
| 30 | + new PlatformConfiguration\HypernodeSettingConfiguration('rabbitmq_enabled', 'True'), |
| 31 | + new PlatformConfiguration\HypernodeSettingConfiguration('elasticsearch_enabled', 'False'), |
| 32 | + new PlatformConfiguration\HypernodeSettingConfiguration('opensearch_enabled', 'True'), |
| 33 | + new PlatformConfiguration\HypernodeSettingConfiguration('varnish_enabled', 'True'), |
| 34 | + new PlatformConfiguration\HypernodeSettingConfiguration('nodejs_version', '20'), |
| 35 | +]); |
| 36 | +``` |
| 37 | + |
| 38 | +## Cron Configuration |
| 39 | + |
| 40 | +Lots of applications need a set of cron jobs for the application to function correctly. Instead of having to configure this on the server manually on each change, you can set this up on the Deployment. |
| 41 | + |
| 42 | +For example, start creating the `./etc/cron` file and adding the following: |
| 43 | + |
| 44 | +```bash |
| 45 | +* * * * * echo 'Hello world!' >> /data/web/cron.log |
| 46 | +``` |
| 47 | + |
| 48 | +The contents of this file will be written and get replaced to your crontab as a separate block on each deployment, this makes it easy to manage and update the crons. |
| 49 | + |
| 50 | +Now add the cron configuration to your `deploy.php` |
| 51 | + |
| 52 | +```php |
| 53 | +$configuration->setPlatformConfigurations([ |
| 54 | + new PlatformConfiguration\CronConfiguration('etc/cron') |
| 55 | +]); |
| 56 | +``` |
| 57 | + |
| 58 | +## Nginx vhost Configuration |
| 59 | + |
| 60 | +You can use Hypernode Deploy to apply nginx configurations set up for your vhost, you do this by creating a new folder for your nginx configurations in `./etc/nginx` and placing your configs there. |
| 61 | + |
| 62 | +```{note} |
| 63 | +All existing nginx configurations will be replaced on first deployment when there's already nginx configurations known for this vhost name. |
| 64 | +``` |
| 65 | + |
| 66 | +Now add the nginx configuration to your `deploy.php` |
| 67 | + |
| 68 | +```php |
| 69 | +$configuration->setPlatformConfigurations([ |
| 70 | + new PlatformConfiguration\NginxConfiguration('etc/nginx') |
| 71 | +]); |
| 72 | +``` |
| 73 | + |
| 74 | +## Supervisor Configuration |
| 75 | + |
| 76 | +Setting up a supervisor configuration is sometimes a requirement for your application, you can easily do this by creating the `./etc/supervisor` folder and creating the supervisor files. |
| 77 | + |
| 78 | +For example, create your `./etc/supervisor/application.conf` file and adding the supervisor configuration to your `deploy.php` |
| 79 | + |
| 80 | +```php |
| 81 | +$configuration->setPlatformConfigurations([ |
| 82 | + new PlatformConfiguration\SupervisorConfiguration('etc/supervisor') |
| 83 | +]); |
| 84 | +``` |
| 85 | + |
| 86 | +## Varnish Configuration |
| 87 | + |
| 88 | +You can update your varnish configuration by adding a file at `etc/varnish.vcl` , and configuring it in `deploy.php` like so: |
| 89 | + |
| 90 | +```php |
| 91 | +$configuration->setPlatformConfigurations([ |
| 92 | + new PlatformConfiguration\VarnishConfiguration( |
| 93 | + $configFile: 'etc/varnish.vcl', |
| 94 | + $version: '7.x' |
| 95 | + ) |
| 96 | +]); |
| 97 | +``` |
0 commit comments