Skip to content

Deployment on a VPS

Chirag Gude edited this page Mar 6, 2015 · 3 revisions

Install Git

Download and extract WanDisco yum repo for Git:

rpm -ivh http://opensource.wandisco.com/centos/6/git/i686/wandisco-git-release-6-1.noarch.rpm

Install Git: yum install git

Install Composer globally

cd /tmp 
curl -sS https://getcomposer.org/installer | php 
mv composer.phar /usr/local/bin/composer

ENV File

Create .env.php file in root directory of project (where composer.json is present) - This file is included in gitignore and meant to be copied manually to Production server. This file should contain all sensitive information meant for the production server. You can also use this same technique for local development, by creating a .env.local.php

<?php
// Settings for Production Server
return [
    'DATABASE_HOST' => 'insert-something',
    'DATABASE_NAME' => 'insert-something',
    'DATABASE_USERNAME' => 'insert-something',
    'DATABASE_PASSWORD' => 'insert-something',
    'APP_ENCRYPT_KEY' => 'insert-something',
    'MAIL_ADDRESS' => 'insert-something',
    'MAILGUN_USERNAME' => 'insert-something',
    'MAILGUN_PASSWORD' => 'insert-something',
    'ADMIN_EMAIL' => 'insert-something',
];

Clone & Deploy app with Git

Clone app
cd /home
git clone https://github.com/chiraggude/larabase.git larabase
Give ownership of all files in /larabase/.git/ to NGINX
chown -R nginx:nginx /home/larabase/.git
Install the app

Folder Ownership & Permissions

If the app has been cloned in /home/larabase
cd /home/larabase/app
chown -R nginx:nginx storage

cd /home/larabase/bootstrap
chown nginx:nginx compiled.php

Composer: Best Practices

Analytics

Add the Analytics JS code in /larabase/public/js/analytics.js