Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs related to provision:website #3836

Closed
midhunmonachan opened this issue May 19, 2024 Discussed in #3821 · 0 comments
Closed

Bugs related to provision:website #3836

midhunmonachan opened this issue May 19, 2024 Discussed in #3821 · 0 comments

Comments

@midhunmonachan
Copy link
Contributor

midhunmonachan commented May 19, 2024

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:

  1. Adding _DIR_ to file reference resulting in file_get_contents(__DIR__ . '/Caddyfile')
  2. Adding Caddyfile to the build
echo "Add file: /Caddyfile\n";
$phar->addFile(realpath(__DIR__ . '/../recipe/provision/Caddyfile'), '/recipe/provision/Caddyfile');

Then i encountered another error:

> 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!

This is where the error happened:

set('deploy_path', run("realpath {{deploy_path}}"));

run("[ -d {{deploy_path}} ] || mkdir -p {{deploy_path}}");
run("chown -R deployer:deployer {{deploy_path}}");

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.


Discussed in #3821

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:

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
```</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants