Skip to content

Instantly share code, notes, and snippets.

@LukeTowers
Last active February 6, 2023 20:58
Show Gist options
  • Save LukeTowers/9100845ba50bd53d957da822d06f3b56 to your computer and use it in GitHub Desktop.
Save LukeTowers/9100845ba50bd53d957da822d06f3b56 to your computer and use it in GitHub Desktop.
Introduction to OctoberCMS
# Setup symlinks in local development copy of Winter to the local development copy of Winter.Workshop
ln -s ~/LocalRepositories/WinterCMS/Themes/Winter/Workshop ~/LocalRepositories/WinterCMS/Core/winter/themes/workshop
# Setup external symlink (for mac, outside of vagrant) to the local development copies of my plugins
ln -s ~/Repositories/WinterCMS/Themes/Winter/Workshop ~/Repositories/WinterCMS/Core/winter/themes/workshop-src
# Setup symlinks in local development copy of Winter to the local development copies of my plugins
ln -s ~/LocalRepositories/WinterCMS/Plugins ~/LocalRepositories/WinterCMS/Core/winter/plugins
# Setup external symlink (for mac, outside of vagrant) to the local development copies of my plugins
ln -s ~/Repositories/WinterCMS/Plugins ~/Repositories/WinterCMS/Core/winter/plugins-src
# Setup symlinks in local development copy of Winter to the local development copy of Winter\Storm
ln -s ~/LocalRepositories/WinterCMS/Core/storm ~/LocalRepositories/WinterCMS/Core/winter/vendor/winter/storm
# Rename all .htm files under a directory to .php files
zmv '(**/)(*).htm' '$1/$2.php'
# Setup external symlink (for mac, outside of vagrant) for the Winter\Storm library
ln -s ~/Repositories/WinterCMS/Core/storm ~/Repositories/WinterCMS/Core/winter/vendor/winter/storm-src
# Sync production storage folder with local
rsync -azP $IP:/srv/users/website-oc-newcriterion/apps/website-oc-newcriterion/shared/storage/app/ ~/Repositories/OctoberCMS/Sites/newcriterion.com/storage/app
# Find the largest file recursively
find . -not -name "*.mp3" -type f -printf "%s\t%p\n" | sort -n | tail -1
# Enable restarting of PHP FPM by deployment users ServerPilot:
visudo -f /etc/sudoers.d/sp-sysusers
Contents:
```
Cmnd_Alias RESTARTPHP = /usr/sbin/service php7.4-fpm-sp restart, /usr/sbin/service php8.0-fpm-sp restart, /usr/sbin/service php8.1-fpm-sp restart, /usr/sbin/service php8.2-fpm-sp restart
%sp-sysusers ALL=NOPASSWD: RESTARTPHP
```

About

Repository for the OctoberCMS-powered Example.com. Active development in develop branch; features in feature branches. Develop locally using Homestead. Pushes to develop are automatically deployed on the dev server.

Setup

  1. Clone the repo
  2. Copy .env.example to .env and configure accordingly (APP_URL and DB credentials)
  3. Run the deployment script below, with the exception that php artisan key:generate needs to be run after composer install

Deployment Script

# Install dependencies from composer.lock
composer install;

# Enable maintenance mode
php artisan down;

# Run any pending migrations
php artisan october:up;

# Remove and regenerate the symlinked public directory for whitelist approach to clean out 
# any references that may have been removed and add any new ones that may have been added
rm -rf public;
php artisan october:mirror public --relative;

# Disable maintenance mode
php artisan up;
# -1. Prepare Composer.
# If you haven't setup Prestissimo yet to speed up Composer then run the following command to do so (https://github.com/hirak/prestissimo)
composer global require hirak/prestissimo
# 0. Install
composer create-project october/october myoctoberfolderhere;
cd myoctoberfolderhere;
# 1. Update .gitignore
cp ../introduction-to-octobercms/.gitignore ./.gitignore;
# 2. Update or remove .md files
rm README.md;
rm LICENSE;
rm CONTRIBUTING.md;
rm ISSUE_TEMPLATE.md;
rm CHANGELOG.md;
cp ../introduction-to-octobercms/README.md ./README.md;
# 3. Switch to dev dependencies
cp -f ../introduction-to-octobercms/composer.json ./composer.json;
composer update;
# 4. Generate and populate environment file & example environment file
php artisan october:env;
cp -f ../introduction-to-octobercms/.env.example ./.env.example;
# 5. Run migrations
php artisan october:up;
# 6. Remove demo theme & plugin
php artisan october:fresh;
# 7. Create blank theme (Note: luketowers.blank-theme not publicly available yet)
php artisan theme:install luketowers.blank theme-dir;
php artisan theme:use theme-dir;
# 8. Change config files
# config/app.php
# - app_name
# config/cms.php
# - edgeUpdates = true // Enables updating plugins not managed by composer to their edge (develop) versions
# - backendTimezone = Whatever timezone most of your backend users will find useful as a default
# - disableCoreUpdates = true // Disables updating the core through the backend interface, this should be managed by composer only
# 9. Generate public folder symlinks
php artisan october:mirror public --relative
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment