Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,18 @@ foreach ($iterator as $fileInfo) {
// Add schema.json
echo "Add file: /src/schema.json\n";
$phar->addFile(realpath(__DIR__ . '/../src/schema.json'), '/src/schema.json');

// Add Caddyfile
echo "Add file: /Caddyfile\n";
$phar->addFile(realpath(__DIR__ . '/../recipe/provision/Caddyfile'), '/recipe/provision/Caddyfile');
// Add bin/dep file
echo "Add file: /bin/dep\n";
$depContent = file_get_contents(__ROOT__ . '/bin/dep');
$depContent = str_replace("#!/usr/bin/env php\n", '', $depContent);
$depContent = str_replace('__FILE__', 'str_replace("phar://", "", Phar::running())', $depContent);
$depContent = preg_replace("/run\('.+?'/", "run('$version'", $depContent);
$phar->addFromString('bin/dep', $depContent);
$phar->setStub(<<<STUB
$phar->setStub(
<<<STUB
#!/usr/bin/env php
<?php
Phar::mapPhar('{$pharName}');
Expand Down
10 changes: 5 additions & 5 deletions docs/recipe/provision/website.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require 'recipe/provision/website.php';

## Configuration
### domain
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L4)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L7)



Expand All @@ -23,7 +23,7 @@ return ask(' Domain: ');


### public_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L8)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L11)



Expand All @@ -36,23 +36,23 @@ return ask(' Public path: ', 'public');
## Tasks

### provision:website
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L13)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L16)

Provision website.




### logs:caddy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L54)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L56)

Shows caddy logs.




### logs:caddy:syslog
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L59)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/provision/website.php#L61)

Shows caddy syslog.

Expand Down
11 changes: 6 additions & 5 deletions recipe/provision/website.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Deployer;

set('domain', function () {
Expand All @@ -11,17 +14,16 @@

desc('Provision website');
task('provision:website', function () {
set('deploy_path', run("realpath {{deploy_path}}"));

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

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

run("[ -d log ] || mkdir log");
run("chgrp caddy log");

$caddyfile = parse(file_get_contents('./Caddyfile'));
$caddyfile = parse(file_get_contents(__DIR__ . '/Caddyfile'));

if (test('[ -f Caddyfile ]')) {
run("echo $'$caddyfile' > Caddyfile.new");
Expand Down Expand Up @@ -59,4 +61,3 @@
task('logs:caddy:syslog', function () {
run('sudo journalctl -u caddy -f');
})->verbose();