These notes are for my hosting environment which is a Linux server running cPanel and Apache.
This is what worked for me and if anyone suggests a better method I'll update accordingly.
Assuming files are committed to GitHub, a deploy key is setup and you are logged into the web server via SSH.
- Add your SSH key to the GitHub repository, be sure to enable
Allow write access
. - Back on the server
git pull
the repository to theroot
of the server cd
into the newly created folder, for exampleNEW_GIT_FOLDER
- Run
composer install
withinNEW_GIT_FOLDER
- Create new
.env
file, adjusting settings forproduction
- The last action is to create a symlink pointing
public_html
to thepublic
withinNEW_GIT_FOLDER
$ ln -sfn NEW_GIT_FOLDER/public public_html
- Generate a new
APP_KEY
by running the following command
$ php artisan key:generate
Note: If you want to be able to run updates from the Dashboard of Statamic, you may need to add an additional line to the .htaccess
file. See Running updates from Statamic dashboard fail below.
When adding a public deploy key to GitHub, be sure to enable Allow write access
. This will allow the site to push changes back to GitHub.
Integration can be controlled by the within the Production Server .env
file. Below is an example of options.
APP_ENV=production
STATAMIC_GIT_USER_NAME=your_github_username
STATAMIC_GIT_USER_EMAIL=your_github_email_address
STATAMIC_GIT_ENABLED=true
STATAMIC_GIT_AUTOMATIC=true
STATAMIC_GIT_PUSH=true
STATAMIC_GIT_DISPATCH_DELAY=120
By default Statamic does not track assets, this can be changed by adding public_path('assets')
to the array in /config/statamic/git.php
.
'paths' => [
base_path('content'),
base_path('users'),
resource_path('blueprints'),
resource_path('fieldsets'),
resource_path('forms'),
resource_path('users'),
storage_path('forms'),
public_path('assets')
],
This error can be overcome by temporarily turning off the composer memory limit and then running the command you wish to preform. Example below.
$ COMPOSER_MEMORY_LIMIT=-1 composer remove statamic/migrator
You may wish to change the memory limit on your local machine. To do this, first we need to find the php.ini
file by running the following command.
$ php -i | grep php.ini
It's then a case of searching for memory_limit
and changing the value.
In Factory.php line 648:
The HOME or COMPOSER_HOME environment variable must be set for composer to
run correctly
This error occurs when Statamic can not find Composer and hence we need to set an environment varible. This can be sorted via the .htaccess
file for servers running Apache.
Simply add the following to the .htaccess
file of public
$ SetEnv COMPOSER_HOME '/opt/cpanel/composer/bin'
To read the Laravel Log, you run this command.
$ cat ~/PATH-TO-FILE/storage/logs/laravel.log
Although incredible helpful, the ~/storage/logs/laravel.log
can become very large. To clear the log you can run this command.
$ truncate -s 0 ~/PATH-TO-FILE/storage/logs/laravel.log
Legend... Thank you.