I repeatedly encountered this error while running provision with deployer v7.4.0 on a clean Ubuntu 20.04 installation
> task provision:website
[beta.midhun.ca] ErrorException in website.php on line 26:
[beta.midhun.ca]
[beta.midhun.ca] file_get_contents(./Caddyfile): Failed to open stream: No such file or directory
[beta.midhun.ca]
ERROR: Task provision:website failed!
I managed to fix it by:
Adding _DIR_ to file reference resulting in file_get_contents(__DIR__ . '/Caddyfile')
> task provision:website
[beta.midhun.ca] error in website.php on line 17:
[beta.midhun.ca] run realpath /var/www/somehostname
[beta.midhun.ca] err realpath: /var/www/somehostname: No such file or directory
[beta.midhun.ca] exit code 1 (General error)
ERROR: Task provision:website failed!
Upon further testing, this happens when /var/www directory is not present.
_So if the parent directory of the deploy_path is absent, this error occurs._
I moved set('deploy_path', run("realpath {{deploy_path}}")); after run("[ -d {{deploy_path}} ] || mkdir -p {{deploy_path}}"); to make sure realpath runs after creating the directory
It seems like code sequence got mixed up when looking at the source provision:website in recipe/provision/website.php.
These fixes the issues i had. I'm working on a PR.
Originally posted by **mariomka** April 23, 2024
- Deployer version: 7.4.0
- Deployment OS: Ubuntu 20.04
I'm trying to provision a clean server in Hetzner Cloud (CCX13 - dedicated 2 vCPU 8GB RAM) with the Laravel recipe. I got an error; I tried several times with different PHP versions and removed and created the server.
The error is the following:
```
[servername] ErrorException in website.php on line 24:
[servername]
[servername] file_get_contents(./Caddyfile): Failed to open stream: No such file or directory
[servername]
ERROR: Task provision:website failed!
```
The `deploy.yaml` file:
```yaml
import:
- recipe/laravel.php
config:
repository: 'git@github.com:XXX/xxx'
hosts:
servername:
remote_user: deployer
deploy_path: '/var/www/my-project'
tasks:
build:
- run: uptime
after:
deploy:failed: deploy:unlock
```
I repeatedly encountered this error while running provision with deployer v7.4.0 on a clean Ubuntu 20.04 installation
I managed to fix it by:
_DIR_
to file reference resulting infile_get_contents(__DIR__ . '/Caddyfile')
Caddyfile
to the buildThen i encountered another error:
This is where the error happened:
Upon further testing, this happens when
/var/www
directory is not present._So if the parent directory of the
deploy_path
is absent, this error occurs._I moved
set('deploy_path', run("realpath {{deploy_path}}"));
afterrun("[ -d {{deploy_path}} ] || mkdir -p {{deploy_path}}");
to make sure realpath runs after creating the directoryIt seems like code sequence got mixed up when looking at the source
provision:website
inrecipe/provision/website.php
.These fixes the issues i had. I'm working on a PR.
Discussed in https://github.com/deployphp/deployer/discussions/3821