Skip to content

Adding a New Application

FrankSiderio edited this page Apr 10, 2018 · 6 revisions

Setting up a new Laravel application on our servers

Prerequisites:

  • How to ssh onto the server. Checkout Server Guide
  • On the server we have: Composer, MySQL, Apache2, PHP7 installed

First, ssh on our server in the data/sga_webapps/htdocs folder. Here. we. go.

  1. git clone the repository of the application you want to add
  2. ls to make sure the application folder was added
  3. cd into that folder so if it was sga-website you'll run cd sga-website
  4. Run a composer update now I can guarantee you'll get a permissions error for the composer.lock file. To get rid of this run sudo chmod 777 composer.lock and run a composer update again
  5. Depending on your db setup (I hope you used migrations) you can run php artisan migrate to create all the tables (make sure your database is created first). Checkout Database guide if you don't know what the hell our database is
  6. If you're a Laravel God (like Frank Siderio) you also have seeders so run php artisan db:seed
  7. Okay if you've made it this far congrats!
  8. Create the .env file by running sudo vi .env
  9. Copy the contents from .env.example and change the database username and password to our db username and password (see CommonKey)
  10. Run php artisan key:generate
  11. Run sudo vi /etc/apache2/vhosts.d/lxsga.conf this is the apache configuration file
  12. You'll need to add this:
Alias /test /data/sga_webapps/htdocs/sga-website/public 
<Directory "/data/sga_webapps/htdocs/sga-website/public">
    Options Includes FollowSymlinks Multiviews AllowOverride All
    Order allow,deny
    Allow from all
 </Directory>

What this is saying is when you visit /test it will run the index file in /data/sga_webapps/htdocs/sga-website/public For any Laravel application you'll need to set the path in the /public folder because the index.php file is in that directory.

  1. In this example navigate to /test and see if you get errors (you probably will)
  2. You will have to give permissions to the /storage and /bootstrap folders

sudo chmod 777 -R /storage and same for /boostrap

  1. This will add these files to git so just check them out we do not want to commit them

Its good to run php artisan serve to see if you get an errors through that. Most of the errors you'll get you can Google and find on Laracasts or StackOverflow.

Clone this wiki locally