Installation: Front-end App
Your LaSalle Software's administrative app must be installed already!
You will need values in your adminstrative app's .env file, so please open your admin app's .env file.
The front-end app does not use a database. Blog posts are created and housed in the back-end's database. To access these blog posts, the front-end makes API calls to the back-end.
RUN COMPOSER CREATE-PROJECT:
In your commmand line, run:
composer create-project --prefer-dist lasallesoftware/ls-basicfrontend-app your-custom-frontend-folder
If you want to paste one of the composer.xxxxxx.json files, most likely "composer.local.json", files into your "composer.json", then do so now. Then run:
To create your .env file, and to set the LaSalle Software specific environment variables for your local environment, run:
php artisan lslibraryfrontend:setenvvars
Please follow the instructions at the end of this artisan command so that your LaSalle Software admin app contains the proper data in the database. Otherwise, your API calls to the admin app will fail.
Please open your .env and double-check that the environment settings are ok.
Set the config parameters as appropriate in "config/lasallesoftware-frontendapp.php". Note the inline comments.
If you are using the contact form package, then set the config parameters as appropriate in "config/lasallesoftware-contactformfrontend.php". Note the inline comments.
Since I am using a Forge/Digital Ocean set-up for my production site, I will go through the steps here.
Do adapt these steps to your particular situation.
Set up your new repository in GitHub
I assume that you are using GitHub, and then deploying your Forge site from GitHub. I assume you know how to set things up in GitHub!
So, if you have not yet created your new repository for your production site in GitHub, please do so now.
I am assuming that you copied "composer.forge.json" to your "composer.json" in your local front-end app.
If not, then make sure your "composer.json" in your local front-end app will be ok for production, as you will be including composer.json in your repo which will be pulled into your production server.
Make your local site, done above, a git repo
You know that local site you did above? Well, time to make it a git repo. In the command line, run:
git add .
git commit -m "The initial commit!"
Please note that your "email@example.com" may be different depending on your local SSH set-up:
git remote add origin firstname.lastname@example.org:account-name/repo-name.git
Push your commit to your remote repo. That "-u" parameter is really important, here's a one minute rabbit hole of note: https://git-scm.com/docs/git-push#Documentation/git-push.txt--u
git push -u origin master
Set up your new site in Forge
My admin app's installation guide has more on this.
Don't forget to create your SSL (LetsEncrypt).
The relatively new User Isolation feature is interesting!
Set up your site's Git Repository
The "Install Repository" box: I un-check "Install Composer Dependencies".
The default "Deploy Script" will then exclude "composer install", which gives you the option when to run it. And, it will exclude "php artisan migrate --force". Even though there are no migrations, I don't want the weird possibility that the front-end is migrating something to the admin database. The front-end and admin apps use the same database.
This is the deploy script Forge creates when you check "Install Composer Dependencies":
cd /home/forge/site-name git pull origin master composer install --no-interaction --prefer-dist --optimize-autoloader ( flock -w 10 9 || exit 1 echo 'Restarting FPM...'; sudo -S service php7.4-fpm reload ) 9>/tmp/fpmlock if [ -f artisan ]; then php artisan migrate --force fi
I modified mine to this:
cd /home/forge/site-name git pull origin master ( flock -w 10 9 || exit 1 echo 'Restarting FPM...'; sudo -S service php7.4-fpm reload ) 9>/tmp/fpmlock
Lately, I've been ssh'ing into my server and running updates directly from the command line.
You are probably ok to check "Install Composer Dependencies", and you are probably ok with the deploy script whence created.
With all that said, click the "Install Repository" button.
SSH into your server to do some command line stuff
SSH into your server, then run:
If not already performed above, run:
composer install --prefer-dist --optimize-autoloader
Open your production admin app's ".env" file so you can reference values for the next step. Then run the setenvvars artisan command:
php artisan lslibraryfrontend:setenvvars
Double check your .env
Please look over your .env settings to make sure they are ok.
Forge may insert default db values. I recommend that you remove these database values from your .env if you are not using a database.
Your site should work.
Mine did not. I got a "403 forbidden" error". I think it was something to do with the Opcache. So I restarted my server, which did the trick:
In production, you should use cloud storage for your images, especially when you are using multiple domains. See the Cloud Storage docs.