joshstrange / laravel-dokku

A PHP Framework For Web Artisans

Home Page:http://laravel.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Dokku

This is a starter project for using Laravel on Dokku with PostgreSQL as the database.

Getting Started

###Steps

  1. Install Dokku on your server or spin up a new droplet with it preinstalled on Digital Ocean

  2. If you installed it yourself please also follow steps 2 and 3 to make sure you have successfully set it up

  3. Install Dokku PostgreSQL plugin (Run on server as root)

cd /var/lib/dokku/plugins
git clone https://github.com/Kloadut/dokku-pg-plugin postgresql
dokku plugins-install
  1. Install dokku-user-env-compile plugin (Run on server as root)
cd /var/lib/dokku/plugins
git clone https://github.com/musicglue/dokku-user-env-compile.git user-env-compile
dokku plugins-install
  1. Clone this repo to your local machine and run the following commands
git clone https://github.com/joshstrange/laravel-dokku
cd laravel-dokku
composer update
git commit -am 'Composer Lock File'
git remote add dokku dokku@YOURHOSTNAME:YOURAPPNAME
git push dokku master

When this is done you should be able to visit the URL provided and see "Laravel Dokku Hello World"

  1. Create PostgreSQL DB for your (Run on server as root), make sure to name the the exact same as your app above
dokku postgresql:create YOURAPPNAME
  1. Add this line to your composer.json file in the "scripts" -> "post-install-cmd" section as the last command
"php artisan migrate"
  1. Commit and push your changes
git commit -am 'Adding DB migrations'
git push dokku master
  1. Now visit YOURAPP/dbtest, you should see the following:
The following was found in the "test" table:
This data was inserted by the migration

That's it! Now you can push your code to Dokku just using git push dokku master after committing your code. The PostgreSQL data is stored on the server running Dokku and not inside the container running PostgreSQL but even then you should probably not run this in production. I use Dokku as my own private Heroku to spin up apps I want to play with and/or test out new ideas.

About

A PHP Framework For Web Artisans

http://laravel.com


Languages

Language:PHP 96.2%Language:Perl 3.8%