Building a small shop with an admin panel made with Vue. This is an Hybrid app with parts
made in plain HTML and others in Vue where SEO is not required.
| Main | User | Admin |
|---|---|---|
These services are required for using the payment functionality in this demo.
Composer and Yarn are required to install and bundle the dependencies.
composer install
cp .env.example .env
# set BRAINTREE_ENV=sandbox
# set BRAINTREE_PRIVATE_KEY=<key>
# set BRAINTREE_PUBLIC_KEY=<key>
# set BRAINTREE_MERCHANT_ID=<key>
# set DB_CONNECTION=sqlite
# set DB_HOST=127.0.0.1
# set DB_PORT=3306
# set DB_DATABASE="/Users/me/projects/animals/database/animals.sqlite"
# set DB_USERNAME=root
# set DB_PASSWORD=
touch database/animals.sqlite
php artisan key:generate
php artisan migrate
php artisan passport:install
php artisan db:seed
yarn
yarn devThe demo can be hosted on Heroku in such a way.
For this example the demo is named: laravel-animals.
- Install Heroku-CLI
- Provision Heroku add-ons and build-packs:
heroku apps:create laravel-animals heroku addons:create heroku-postgresql:hobby-dev --app laravel-animals heroku buildpacks:add heroku/php --app laravel-animals heroku buildpacks:add heroku/nodejs --app laravel-animals
- Add Heroku to git remote:
heroku git:remote --app laravel-animals
- Set environmental variables on Heroku:
heroku config:set --app laravel-animals APP_KEY=$(php artisan --no-ansi key:generate --show) heroku config:set --app laravel-animals APP_URL=$(heroku info -s | grep web_url | cut -d= -f2) heroku config:set --app laravel-animals MIX_APP_URL=$(heroku info -s | grep web_url | cut -d= -f2 | sed "s/\$/api/g") heroku config:set --app laravel-animals NPM_CONFIG_PRODUCTION=false heroku config:set --app laravel-animals APP_IMAGE_PATH=images heroku config:set --app laravel-animals FILESYSTEM_DRIVER=heroku heroku config:set --app laravel-animals BRAINTREE_ENVIRONMENT=sandbox heroku config:set --app laravel-animals BRAINTREE_MERCHANT_ID=<id> heroku config:set --app laravel-animals BRAINTREE_PUBLIC_KEY=<key> heroku config:set --app laravel-animals BRAINTREE_PRIVATE_KEY=<key>
- Deploy to Heroku
git push heroku master
- Run demo migrations and optimizations
heroku run -a laravel-animals php artisan migrate heroku run -a laravel-animals php artisan db:seed heroku run -a laravel-animals php artisan config:cache heroku run -a laravel-animals php artisan route:cache
- Enable debugging (Optional, be sure not to run this on production, and prune telescope entries regularly)
heroku config:set --app laravel-animals APP_ENV=development APP_DEBUG=true APP_LOG_LEVEL=debug TELESCOPE_ENABLED=true
Any issues during deployment are usually because of wrong env variables for external services (redis, postgres, braintree, etc).