Sync to Production

You may automatically sync all commits to production or other servers after a successful run of the CI pipeline, although there are a few steps to accomplish this. as explained below.

First, on your local development machine, install the svn-sync package and commit with the commands:

apex install svn-sync

apex commit

Login to the remote server, and find the user and group the HTTP server (ie. Nginx / Apache) listens on such as www-data. Change to that user with the command:

su www-data.

Install the project on the remote server as described within the Deploy / Install Project page. Ensure you are logged in with the user that listens to the HTTP server while installing.

On the remote server, ensure the Apex installation directory is owned by the same user and group that the HTTP server is listening on. For example, if the user / group listening is www-data and installation directory is /var/www/, you could run the command:

chown -R www-data:www-data /var/www.

Check and ensure your Apex account can be found while logged in as the user who listens to the HTTP server with the account list CLI command:

apex account list

You should see your Apex account within the list, and if you do not, import your account using the account import CLI command, such as:

apex account import.

Within the installation directory, run the project sync CLI command, such as:

apex project sync

This will prompt you to confirm you would like to enable the svn-sync package, then provide you with a URL that includes the API key. On the local development machine, open the package.yml file located at /etc/<PROJECT>/package.yml, and add the web_hooks section such as:

web_hooks:
  - https://your-domain.com/svn_syc?apikey=<API_KEY>

Once the package.yml file is saved, on the local development machine run the package update CLI command to update the repository with the web hook, such as:

apex package update <PROJECT>

That's it, and syncing should now work perfectly fine. Give it a try by updating a view or simliar on your local development machine then run apex commit. Assuming it passes all checks within the CI pipeline, you should notice the changes on the remote server near instantly.