Skip to content

Commit 6af6302

Browse files
committed
Start InitRepo command
1 parent aecb562 commit 6af6302

File tree

9 files changed

+498
-7
lines changed

9 files changed

+498
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Laravel Heroku Deploy
55

6-
This Laravel 7 package allows you to configure your Heroku Review Apps instance for Laravel applications. You can manage custom domains using Cloudflare, apply Automated Certificate Management (ACM) with Lets Encrypt and update Config Vars using Heroku's `postdeploy` and `pr-predestroy` script events.
6+
This Laravel 7+ package allows you to configure your Heroku Review Apps instance for Laravel applications. You can manage custom domains using Cloudflare, apply Automated Certificate Management (ACM) with Lets Encrypt and update Config Vars using Heroku's `postdeploy` and `pr-predestroy` script events.
77

88
## Installation
99

@@ -35,7 +35,7 @@ return [
3535
// Cloudflare token, get yours here:
3636
// https://dash.cloudflare.com/profile/api-tokens
3737
'cloudflare_token' => env('HEROKU_DEPLOY_CLOUDFLARE_TOKEN', null),
38-
// Created by Heroku
38+
// Created by Heroku, just capture the information
3939
'app_name' => env('HEROKU_APP_NAME', null),
4040
'pr_number' => env('HEROKU_PR_NUMBER', null),
4141
// JSON array containing information on your zones you want to use for this project

app.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "%1$s-app",
3+
"environments": {
4+
"test": {
5+
"buildpacks": [
6+
{ "url": "heroku/php" }
7+
],
8+
"scripts": {
9+
"test-setup": "php artisan migrate --env='testing'",
10+
"test": "phpunit"
11+
},
12+
"addons": [
13+
"heroku-redis:hobby-dev --maxmemory_policy allkeys-lru",
14+
"heroku-postgresql:hobby-dev"
15+
],
16+
"env": {
17+
"APP_ENV": "testing",
18+
"BCRYPT_ROUNDS": "4",
19+
"CACHE_DRIVER": "array",
20+
"DB_CONNECTION": "sqlite",
21+
"DB_DATABASE": ":memory:",
22+
"MAIL_MAILER": "array",
23+
"QUEUE_CONNECTION": "sync",
24+
"SESSION_DRIVER": "array",
25+
"TELESCOPE_ENABLED": "false"
26+
}
27+
}
28+
}
29+
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
],
1212
"require": {
1313
"php": "^7.3",
14-
"illuminate/support": "^7",
14+
"illuminate/support": "^7|^8",
1515
"guzzlehttp/guzzle": "^6.3|^6.4|^6.5|^7.0",
16-
"illuminate/routing": "^7"
16+
"illuminate/routing": "^7|^8"
1717
},
1818
"require-dev": {
1919
"orchestra/testbench": "^5.0",

config/database.php

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<?php
2+
3+
use Illuminate\Support\Str;
4+
5+
$url = parse_url(getenv('DATABASE_URL'));
6+
$redis_url = parse_url(getenv('REDIS_URL'));
7+
8+
return [
9+
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Default Database Connection Name
13+
|--------------------------------------------------------------------------
14+
|
15+
| Here you may specify which of the database connections below you wish
16+
| to use as your default connection for all database work. Of course
17+
| you may use many connections at once using the Database library.
18+
|
19+
*/
20+
21+
'default' => env('DB_CONNECTION', 'mysql'),
22+
23+
/*
24+
|--------------------------------------------------------------------------
25+
| Database Connections
26+
|--------------------------------------------------------------------------
27+
|
28+
| Here are each of the database connections setup for your application.
29+
| Of course, examples of configuring each database platform that is
30+
| supported by Laravel is shown below to make development simple.
31+
|
32+
|
33+
| All database work in Laravel is done through the PHP PDO facilities
34+
| so make sure you have the driver for your particular database of
35+
| choice installed on your machine before you begin development.
36+
|
37+
*/
38+
39+
'connections' => [
40+
41+
'sqlite' => [
42+
'driver' => 'sqlite',
43+
'url' => env('DATABASE_URL'),
44+
'database' => env('DB_DATABASE', database_path('database.sqlite')),
45+
'prefix' => '',
46+
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
47+
],
48+
49+
'mysql' => [
50+
'driver' => 'mysql',
51+
'url' => env('DATABASE_URL'),
52+
'host' => env('DB_HOST', '127.0.0.1'),
53+
'port' => env('DB_PORT', '3306'),
54+
'database' => env('DB_DATABASE', 'forge'),
55+
'username' => env('DB_USERNAME', 'forge'),
56+
'password' => env('DB_PASSWORD', ''),
57+
'unix_socket' => env('DB_SOCKET', ''),
58+
'charset' => 'utf8mb4',
59+
'collation' => 'utf8mb4_unicode_ci',
60+
'prefix' => '',
61+
'prefix_indexes' => true,
62+
'strict' => true,
63+
'engine' => null,
64+
'options' => extension_loaded('pdo_mysql') ? array_filter([
65+
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
66+
]) : [],
67+
],
68+
69+
'pgsql' => [
70+
'driver' => 'pgsql',
71+
'url' => env('DATABASE_URL'),
72+
'host' => env('DB_HOST', '127.0.0.1'),
73+
'port' => env('DB_PORT', '5432'),
74+
'database' => env('DB_DATABASE', 'forge'),
75+
'username' => env('DB_USERNAME', 'forge'),
76+
'password' => env('DB_PASSWORD', ''),
77+
'charset' => 'utf8',
78+
'prefix' => '',
79+
'prefix_indexes' => true,
80+
'schema' => 'public',
81+
'sslmode' => 'prefer',
82+
],
83+
84+
'sqlsrv' => [
85+
'driver' => 'sqlsrv',
86+
'url' => env('DATABASE_URL'),
87+
'host' => env('DB_HOST', 'localhost'),
88+
'port' => env('DB_PORT', '1433'),
89+
'database' => env('DB_DATABASE', 'forge'),
90+
'username' => env('DB_USERNAME', 'forge'),
91+
'password' => env('DB_PASSWORD', ''),
92+
'charset' => 'utf8',
93+
'prefix' => '',
94+
'prefix_indexes' => true,
95+
],
96+
97+
'heroku' => [
98+
'driver' => 'pgsql',
99+
'host' => isset($url['host']) ? $url['host'] : env('DB_HOST', '127.0.0.1'),
100+
'database' => isset($url['path']) ? substr($url['path'], 1) : env('DB_DATABASE', 'forge'),
101+
'username' => isset($url['user']) ? $url['user'] : env('DB_USERNAME', 'forge'),
102+
'password' => isset($url['pass']) ? $url['pass'] : env('DB_PASSWORD', ''),
103+
'charset' => 'utf8',
104+
'prefix' => '',
105+
'schema' => 'public',
106+
],
107+
108+
],
109+
110+
/*
111+
|--------------------------------------------------------------------------
112+
| Migration Repository Table
113+
|--------------------------------------------------------------------------
114+
|
115+
| This table keeps track of all the migrations that have already run for
116+
| your application. Using this information, we can determine which of
117+
| the migrations on disk haven't actually been run in the database.
118+
|
119+
*/
120+
121+
'migrations' => 'migrations',
122+
123+
/*
124+
|--------------------------------------------------------------------------
125+
| Redis Databases
126+
|--------------------------------------------------------------------------
127+
|
128+
| Redis is an open source, fast, and advanced key-value store that also
129+
| provides a richer body of commands than a typical key-value system
130+
| such as APC or Memcached. Laravel makes it easy to dig right in.
131+
|
132+
*/
133+
134+
'redis' => [
135+
136+
'client' => env('REDIS_CLIENT', 'phpredis'),
137+
138+
'options' => [
139+
'cluster' => env('REDIS_CLUSTER', 'redis'),
140+
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
141+
],
142+
143+
'default' => [
144+
'host' => isset($redis_url['host']) ? $redis_url['host'] : env('REDIS_HOST', '127.0.0.1'),
145+
'password' => isset($redis_url['pass']) ? $redis_url['pass'] : env('REDIS_PASSWORD', null),
146+
'port' => isset($redis_url['port']) ? $redis_url['port'] : env('REDIS_PORT', 6379),
147+
'database' => env('REDIS_DB', '0'),
148+
],
149+
150+
'cache' => [
151+
'host' => isset($redis_url['host']) ? $redis_url['host'] : env('REDIS_HOST', '127.0.0.1'),
152+
'password' => isset($redis_url['pass']) ? $redis_url['pass'] : env('REDIS_PASSWORD', null),
153+
'port' => isset($redis_url['port']) ? $redis_url['port'] : env('REDIS_PORT', 6379),
154+
'database' => env('REDIS_CACHE_DB', '1'),
155+
],
156+
157+
],
158+
159+
];

nginx_app.conf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
gzip on;
2+
gzip_disable "msie6";
3+
4+
gzip_vary on;
5+
gzip_proxied any;
6+
gzip_comp_level 6;
7+
gzip_buffers 16 8k;
8+
gzip_min_length 256;
9+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon application/atom+xml application/rss+xml application/x-web-app-manifest+json application/xhtml+xml text/x-component image/png image/jpeg font/woff2 application/font-woff;
10+
11+
client_max_body_size 10M;
12+
13+
location / {
14+
# try to serve file directly, fallback to rewrite
15+
try_files $uri @rewriteapp;
16+
}
17+
18+
location @rewriteapp {
19+
# rewrite all to app.php
20+
rewrite ^(.*)$ /index.php/$1 last;
21+
}
22+
23+
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff)$ {
24+
expires 30d;
25+
}
26+
27+
# Remove trailing slash. #
28+
if (!-d $request_filename) {
29+
rewrite ^/(.+)/$ /$1 permanent;
30+
}
31+
32+
# Clean Double Slashes
33+
if ($request_uri ~* "\/\/") {
34+
rewrite ^/(.*) /$1 permanent;
35+
}

0 commit comments

Comments
 (0)