-
-
Save tebajanga/ed5d4372c7380dea6c0f591e48470f8e to your computer and use it in GitHub Desktop.
Laravel configs for Heroku/Dokku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "laravel-test", | |
"description": "A barebones Laravel 5 app on Dokku/Heroku.", | |
"keywords": [ | |
"laravel", | |
"dokku", | |
"heroku" | |
], | |
"scripts": { | |
"dokku": { | |
"predeploy": ".dokku/predeploy.sh", | |
"postdeploy": ".dokku/postdeploy.sh" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/heroku/heroku-buildpack-php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (getenv('DATABASE_URL')) { | |
$url = parse_url(env("DATABASE_URL")); | |
// Laravel's env() uses getenv(), not $_ENV[] | |
putenv('DB_CONNECTION=' . ($url['scheme'] == 'postgres' ? 'pgsql' : $url['scheme'])); | |
putenv("DB_HOST={$url['host']}"); | |
putenv("DB_PORT={$url['port']}"); | |
putenv("DB_USERNAME={$url['user']}"); | |
putenv("DB_PASSWORD={$url['pass']}"); | |
putenv('DB_DATABASE=' . substr($url['path'], 1)); // Remove leading slash from path | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail; | |
# Create storage paths if missing in persistent storage. | |
mkdir -p storage/app/public | |
mkdir -p storage/framework/{cache,sessions,testing,views} | |
mkdir -p storage/logs | |
# Link already created in predeploy. | |
# Run for a confirmation message that it was created successfully. | |
php artisan storage:link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail; | |
# Remove old symlink in public/storage if exists | |
[[ -r public/storage ]] && rm public/storage | |
# Create storage paths if missing in container. | |
# NOTE: Persistent storage still not mounted in predeploy step. | |
mkdir -p storage/app/public | |
mkdir -p storage/framework/{cache,sessions,testing,views} | |
mkdir -p storage/logs | |
# Create storage symlink in predeploy linking to container, not persistent storage. | |
# Link target will be substituted when persistent storage is mounted. | |
php artisan storage:link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: vendor/bin/heroku-php-apache2 public/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment