Server could not be written to
When adding a server, or running a deployment (during preflight checks) you may run into the following error:
Server could not be written to. Check that the path/container you have entered exists and that the user has write access.
or
Server Failed to execute [open {DEPLOYMENT_PATH}/deploy-test-file.html] - no such file
If this error happens, it means DeployHQ can connect to the server initially, but not complete the test process whereby it writes a temporary test file to your deployment to check access.
There are a number of checks that can be performed at this stage.
Valid deployment path
If a deployment path has been entered in your server settings, you'll need to verify that it's correct and accessible.
The easiest way to test this is by connecting to your server via a terminal or FTP/SFTP client, and navigating to that path directly.
It might be the case that your user is jailed or chrooted, meaning it doesn't have access to the root of the server. Therefore a path such as /var/www/your-site
might not work, but simply your-site
does.
User permissions
If you're happy that the deployment path is correct, you'll need to check that the directory has appropriate read and write permissions assigned to your user. The easiest way to verify permissions is to run the following command in your terminal when logged in as the deployment user:
$ ls -ld /deployment/path
total 70712
drwx------ 3 user group 102 23 May 12:55 /deployment/path
The user will either need to the owner of the directory, or, part of the user group with read and write permissions granted to the group as well.