diff --git a/.gitignore b/.gitignore index c561e9b..2677423 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ Homestead.json Homestead.yaml .env +codeship.aes +deployment.env diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..96eb5c7 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: vendor/bin/heroku-php-nginx -C nginx.heroku.conf /public diff --git a/app/Todo.php b/app/Todo.php index a1742ee..fc5d39b 100644 --- a/app/Todo.php +++ b/app/Todo.php @@ -40,7 +40,7 @@ public function getUrlAttribute() $url = $url.':'.$url_arr['port']; } - return $url.'/'.$this->attributes['id']; + return $url.'/todos/'.$this->attributes['id']; } } diff --git a/codeship-steps.yml b/codeship-steps.yml index 56987e0..d83da71 100644 --- a/codeship-steps.yml +++ b/codeship-steps.yml @@ -9,3 +9,7 @@ tag: master service: deploy command: codeship_heroku deploy /deploy php-laravel-todoapp + - name: migrate + tag: master + service: deploy + command: heroku run --app php-laravel-todoapp -- php artisan migrate diff --git a/config/database.php b/config/database.php index 031e462..4b032ce 100644 --- a/config/database.php +++ b/config/database.php @@ -3,7 +3,7 @@ $url = parse_url(getenv("DATABASE_URL")); $host = $url["host"]; $username = $url["user"]; -$password = isset($url["pass"]) ?: ''; +$password = isset($url["pass"]) ? $url["pass"] : ''; $database = substr($url["path"], 1); return [ diff --git a/deployment.env.encrypted b/deployment.env.encrypted new file mode 100644 index 0000000..38c641a --- /dev/null +++ b/deployment.env.encrypted @@ -0,0 +1 @@ +dDwXrmLJLl6kAHIdB5i/LDPa58oMHH4qjm+iZxOQDG0/rUjDiXjGj4mm7rQy+oYed4QrL9ocVY5i4a9EMjdCHn0iOFI= \ No newline at end of file diff --git a/nginx.heroku.conf b/nginx.heroku.conf new file mode 100644 index 0000000..90b9501 --- /dev/null +++ b/nginx.heroku.conf @@ -0,0 +1,14 @@ +location / { + # try to serve file directly, fallback to rewrite + try_files $uri @rewriteapp; +} + +location @rewriteapp { + # rewrite all to app.php + rewrite ^(.*)$ /index.php/$1 last; +} + +location ~ ^/(app|app_dev|config)\.php(/|$) { + try_files @heroku-fcgi @heroku-fcgi; + internal; +}