Skip to content

Instantly share code, notes, and snippets.

@chkilel
Last active November 21, 2020 13:52
Show Gist options
  • Save chkilel/abc302a6f52966497ad0c47b52218509 to your computer and use it in GitHub Desktop.
Save chkilel/abc302a6f52966497ad0c47b52218509 to your computer and use it in GitHub Desktop.
**Lando** init file to Bootstrap an "OctoberCMS" local development environment with "OFFLINE-GmbH/oc-bootstrapper"
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.sass-cache*
# node.js and bower files
node_modules
npm-debug.log
npm-shrinkwrap.json
.tmp
.sass-cache
bower_components
bower.json
# user files
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# Workspace files are user-specific
*.sublime-workspace
# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
*.sublime-project
# SFTP configuration file
sftp-config.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea
# CMake
cmake-build-debug/
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Yarn
yarn.lock
# October CMS
/storage
/config/database.php
/storage/*.key
/vendor
/modules
#/config
/bootstrap
/themes/demo
/themes/*/content
/themes/*/meta
/.vagrant
Homestead.json
Homestead.yaml
.env
*
!.gitignore
!composer.*
composer.phar
!.env.*
!october.yaml
!Envoy.blade.php
!.gitlab-ci.yml
# exclude everything except directory themes/mythemename
!/themes
!/themes/chkilel
/themes/*
themes/**/*
/themes/demo
# and plugins/myplugin
!/plugins
/plugins/*
!/plugins/chkilel
!plugins/chkilel/*
# exclude some needed files
!.lando.yml
!october.yml
!composer.json.dev
!.gitignore.dev
!README.md.dev
!setupDev.sh
# The App name, must be unique, check the exitance of the APP by running `lando list --all` befor starting the APP
# Need to be changed before starting the APP
name: chkilel # MUST BE MODIFIED BEFORE FIRING UP THE LOCAL DEV
# Recipe type, lamp stand for linux-apache-mysql-php
# See https://docs.devwithlando.io for further information
recipe: lamp
config:
webroot: .
# Add additional dependencies or build steps to your service.
# Note that build steps will ONLY RUN THE FIRST TIME YOU SPIN UP YOUR APP.
# That means that if you change them you will need to run lando rebuild for them to re-run.
# See https://docs.devwithlando.io/config/services.html#build-steps
# This will add October CMS Bootstrapper.
# See https://github.com/OFFLINE-GmbH/oc-bootstrapper/tree/master
services:
appserver:
# Adding offline/oc-bootstrapper to the build
build:
- composer global require offline/oc-bootstrapper
# Adding mailhog to catch sent mail on
# *** mail.YOUR_LANDO_APP_NAME.lndo.site ***
# In the backend (mail configuration) switch the Mail method to 'sendmail'
mailhog:
type: mailhog
portforward: true
hogfrom:
- appserver
proxy:
# Change it to mail.YOUR_LANDO_APP_NAME.lndo.site
mailhog:
- mail.chkilel.lndo.site
# Add the command `october` to lando.
# See https://docs.devwithlando.io/config/tooling.html for tooling
tooling:
october:
service: appserver

About

Bootstrap an OctoberCMS local development environment with LANDO and OFFLINE-GmbH/oc-bootstrapper

Setup

  1. Install the latest release of lando depending on your OS system if it's not already done.

  2. Create a directory for you octoberCMS instance, let's name it chkilel

  3. CD to this directory:

    $ CD chkilel
  4. Clone the repo

    $ git clone https://github.com/chkilel/oc-lando-setup.git .
  5. Modify the APP name in the .lando.yml file, the APP name, must be unique, check the exitance of the APP by running lando list --all befor starting the APP, See comments in the file.

    name: nameOfTheApp # MUST BE MODIFIED BEFOR FIRING UP THE LOCAL DEV ENVIRONMENT
  6. Start the APP by running

    $ lando start

    After the local dev fire up, you will see

    BOOMSHAKALAKA!!!
    
    Your app has started up correctly.
    Here are some vitals:
    
    NAME            chkilel                           
    LOCATION        /Users/Adil/Sites/october/chkilel 
    SERVICES        appserver, database               
    APPSERVER URLS  https://localhost:32900           
                    http://localhost:32901            
                    http://chkilel.lndo.site          
                    https://chkilel.lndo.site
    MAILHOG URLS    http://localhost:32789            
                    http://mail.chkilel.lndo.site     
                    https://mail.chkilel.lndo.site  
  7. Initialize your project, use the october init command to create a new empty project with a config file:

    $ lando october init
  8. Change your configuration in your newly created project directory you'll find an october.yaml file. Edit its contents to suite your needs, refere to oc-bootstrapper for more details

    app:
    url: 'http://chkilel.lndo.site'
    locale: en
    debug: true
    
    cms:
        theme: oc-bootstrap (https://github.com/prismify/oc-bootstrap-theme.git)
        edgeUpdates: false
        enableSafeMode: false
        # project: XXXX            # Marketplace project ID
    
    database:
        connection: mysql
        host: database # naming convention for LANDO, alaways default host is database
        username: lamp # the name is the same as the recipe name of the .lando.yml file
        password: lamp # the name is the same as the recipe name of the .lando.yml file
        database: lamp # the name is the same as the recipe name of the .lando.yml file
    
    plugins:
        - Vdlp.Redirect
        - Rainlab.Pages
        - Rainlab.Blog
        - Rainlab.User
        - Rainlab.Builder
        - Indikator.Backend
        - Inetis.Dump
        # - LukeTowers.EssentialVars
        # - LukeTowers.TwigPCRE
        # - OFFLINE.SiteSearch
        - OFFLINE.ResponsiveImages
        
        # Install a plugin from the official October Marketplace
        # - OFFLINE.Mall 
        
        # Install a plugin from a git repository. The plugin will be cloned
        # into your local repository and become part of it. You can change the
        # plugin and modify it to your needs. It won't be checked out again (no updates).
        # - OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git)
        
        # The ^ marks this plugin as updateable. It will be removed and checked out again
        # during each call to `october install`. Local changes will be overwritten.
        # This plugin will stay up to date with the changes of your original plugin repo.
        # - ^OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git)
    
        # Install a specific branch of a plugin. Keep it up-to-date.
        # - ^OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git#develop)
        # - Vendor.Private (user@remote.git)
        # - Vendor.PrivateCustomBranch (user@remote.git#branch)
    
        #Run lando info and check host in 
        #           external_connection: {
        #               host: 'localhost',
        #               port: '32939'
        #           },
    mail:
        # Change the host according to the information above
        # Must be checked in every start of the Dev Environment because the "port" change
        # Or Change it to mail.YOUR_LANDO_APP_NAME.lndo.site like the example below
        # See proxy.mailhog in the .lando.yml file
        host: mail.chkilel.lndo.site 
        name: Adil Chehabi
        address: chkilel@cheha.bi
        driver: sendmail
  9. When you are done editing your configuration file, simply run october install to install October. oc-bootstrapper will take care of setting everything up for you. You can run this command locally after checking out a project repository or during deployment. This command is idempotent, it will only install what is missing on subsequent calls.

    $ lando october install

    Use the --help flag to see all available options.

    lando october install --help
  10. If at any point in time you need to install additional plugins, simply add them to your october.yaml and re-run october install. Missing plugins will be installed.

  11. If you want to update the installation you can run

    $ lando october update
  12. To push local changes to the current git remote run

    $ lando october push

If you are actively developing a site and would like to get the latest and greatest changes for October when updating, then

  1. Change the following config files

    • config/app.php
    'name' => 'October CMS' // Your App/Site name
    • config/cms.php
    edgeUpdates = true // Enables updating plugins not managed by composer to their edge (develop) versions
    backendTimezone = 'UTC' // 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
  2. Run the script below

    $ ./setupDev.sh

    If needed, make it executable

    $ chmod +x setupDev.sh
# New October CMS Project for development
***
## About
Bootstrap an **OctoberCMS** local development environment with [LANDO](https://docs.devwithlando.io/) and [OFFLINE-GmbH/oc-bootstrapper](https://github.com/OFFLINE-GmbH/oc-bootstrapper)
## Setup
0. Install the latest release of [lando](https://github.com/lando/lando/releases) depending on your OS system if it's not already done.
1. Create a directory for you octoberCMS instance, let's name it **chkilel**
2. CD to this directory:
```shell
$ CD chkilel
```
3. Clone the repo
```shell
$ git clone https://github.com/chkilel/oc-lando-setup.git .
```
4. Modify the APP name in the .lando.yml file, the APP name, must be unique, check the exitance of the APP by running `lando list --all` befor starting the APP, See comments in the file.
```yaml
name: nameOfTheApp # MUST BE MODIFIED BEFOR FIRING UP THE LOCAL DEV ENVIRONMENT
```
5. Start the APP by running
```shell
$ lando start
```
After the local dev fire up, you will see
```shell
BOOMSHAKALAKA!!!
Your app has started up correctly.
Here are some vitals:
NAME chkilel
LOCATION /Users/Adil/Sites/october/chkilel
SERVICES appserver, database
APPSERVER URLS https://localhost:32900
http://localhost:32901
http://chkilel.lndo.site
https://chkilel.lndo.site
MAILHOG URLS http://localhost:32789
http://mail.chkilel.lndo.site
https://mail.chkilel.lndo.site
```
6. Initialize your project, use the october init command to create a new empty project with a config file:
```shell
$ lando october init
```
7. Change your configuration in your newly created project directory you'll find an october.yaml file. Edit its contents to suite your needs, refere to [oc-bootstrapper](https://github.com/OFFLINE-GmbH/oc-bootstrapper) for more details
```yaml
app:
url: 'http://chkilel.lndo.site'
locale: en
debug: true
cms:
theme: oc-bootstrap (https://github.com/prismify/oc-bootstrap-theme.git)
edgeUpdates: false
enableSafeMode: false
# project: XXXX # Marketplace project ID
database:
connection: mysql
host: database # naming convention for LANDO, alaways default host is database
username: lamp # the name is the same as the recipe name of the .lando.yml file
password: lamp # the name is the same as the recipe name of the .lando.yml file
database: lamp # the name is the same as the recipe name of the .lando.yml file
plugins:
- Vdlp.Redirect
- Rainlab.Pages
- Rainlab.Blog
- Rainlab.User
- Rainlab.Builder
- Indikator.Backend
- Inetis.Dump
# - LukeTowers.EssentialVars
# - LukeTowers.TwigPCRE
# - OFFLINE.SiteSearch
- OFFLINE.ResponsiveImages
# Install a plugin from the official October Marketplace
# - OFFLINE.Mall
# Install a plugin from a git repository. The plugin will be cloned
# into your local repository and become part of it. You can change the
# plugin and modify it to your needs. It won't be checked out again (no updates).
# - OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git)
# The ^ marks this plugin as updateable. It will be removed and checked out again
# during each call to `october install`. Local changes will be overwritten.
# This plugin will stay up to date with the changes of your original plugin repo.
# - ^OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git)
# Install a specific branch of a plugin. Keep it up-to-date.
# - ^OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git#develop)
# - Vendor.Private (user@remote.git)
# - Vendor.PrivateCustomBranch (user@remote.git#branch)
#Run lando info and check host in
# external_connection: {
# host: 'localhost',
# port: '32939'
# },
mail:
# Change the host according to the information above
# Must be checked in every start of the Dev Environment because the "port" change
# Or Change it to mail.YOUR_LANDO_APP_NAME.lndo.site like the example below
# See proxy.mailhog in the .lando.yml file
host: mail.chkilel.lndo.site
name: Adil Chehabi
address: chkilel@cheha.bi
driver: sendmail
```
8. When you are done editing your configuration file, simply run `october install` to install October. **oc-bootstrapper** will take care of setting everything up for you. You can run this command locally after checking out a project repository or during deployment.
This command is idempotent, it will only install what is missing on subsequent calls.
```shell
$ lando october install
```
Use the --help flag to see all available options.
```shell
lando october install --help
````
9. If at any point in time you need to **install additional plugins**, simply add them to your october.yaml and re-run `october install`. Missing plugins will be installed.
10. If you want to **update the installation** you can run
```shell
$ lando october update
```
11. To push local changes to the current **git remote** run
```shell
$ lando october push
```
***
# If you are actively developing a site and would like to get the latest and greatest changes for October when updating, then
12. Change the following config files
- **config/app.php**
```php
'name' => 'October CMS' // Your App/Site name
```
- **config/cms.php**
```php
edgeUpdates = true // Enables updating plugins not managed by composer to their edge (develop) versions
backendTimezone = 'UTC' // 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
```
12. Run the script below
```shell
$ ./setupDev.sh
```
If needed, make it executable
```shell
$ chmod +x setupDev.sh
```
{
"name": "october/october",
"description": "October CMS",
"homepage": "https://octobercms.com",
"keywords": ["october", "cms", "octobercms", "laravel"],
"license": "MIT",
"authors": [{
"name": "Alexey Bobkov",
"email": "aleksey.bobkov@gmail.com",
"role": "Co-founder"
},
{
"name": "Samuel Georges",
"email": "daftspunky@gmail.com",
"role": "Co-founder"
},
{
"name": "Luke Towers",
"email": "octobercms@luketowers.ca",
"homepage": "https://luketowers.ca",
"role": "Maintainer"
}
],
"support": {
"issues": "https://github.com/octobercms/october/issues",
"forum": "https://octobercms.com/forum/",
"docs": "https://octobercms.com/docs/",
"irc": "irc://irc.freenode.net/october",
"source": "https://github.com/octobercms/october"
},
"require": {
"php": ">=7.0",
"ext-mbstring": "*",
"ext-openssl": "*",
"october/rain": "dev-develop as 1.0",
"october/system": "dev-develop",
"october/backend": "dev-develop",
"october/cms": "dev-develop",
"laravel/framework": "5.5.*@dev",
"wikimedia/composer-merge-plugin": "dev-master",
"offline/oc-bootstrapper": "^0.5.5"
},
"require-dev": {
"fzaninotto/faker": "~1.7",
"phpunit/phpunit": "~5.7",
"phpunit/phpunit-selenium": "~1.2",
"meyfa/phpunit-assert-gd": "1.1.0"
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/UiTestCase.php",
"tests/PluginTestCase.php"
]
},
"scripts": {
"post-create-project-cmd": [
"php artisan key:generate",
"php artisan package:discover"
],
"post-update-cmd": [
"php artisan october:util set build",
"php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"platform": {
"php": "7.0"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"merge-plugin": {
"include": [
"plugins/*/*/composer.json"
],
"recurse": true,
"replace": false,
"merge-dev": false
}
}
}
app:
url: 'http://chkilel.lndo.site'
locale: en
debug: true
cms:
theme: oc-bootstrap-theme (https://github.com/prismify/oc-bootstrap-theme.git)
edgeUpdates: false
enableSafeMode: false
# project: XXXX # Marketplace project ID
database:
connection: mysql
host: database
port: 3306
username: lamp
password: lamp
database: lamp
git:
deployment: false
bareRepo: true # Exclude everything except themes and custom plugins in git
excludePlugins: false # Even exclude plugins from your repo. Private plugins will be
# checkout out again during each "install" run. Be careful!
# Manual changes to these plugins will be overwritten.
plugins:
- Vdlp.Redirect
- Rainlab.Pages
- Rainlab.Blog
- Rainlab.User
- Rainlab.Builder
- Indikator.Backend
- Inetis.Dump
# - LukeTowers.EssentialVars
# - LukeTowers.TwigPCRE
# - OFFLINE.SiteSearch
- OFFLINE.ResponsiveImages
# Install a plugin from the official October Marketplace
# - OFFLINE.Mall
# Install a plugin from a git repository. The plugin will be cloned
# into your local repository and become part of it. You can change the
# plugin and modify it to your needs. It won't be checked out again (no updates).
# - OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git)
# The ^ marks this plugin as updateable. It will be removed and checked out again
# during each call to `october install`. Local changes will be overwritten.
# This plugin will stay up to date with the changes of your original plugin repo.
# - ^OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git)
# Install a specific branch of a plugin. Keep it up-to-date.
# - ^OFFLINE.Mall (https://github.com/OFFLINE-GmbH/oc-mall-plugin.git#develop)
# - Vendor.Private (user@remote.git)
# - Vendor.PrivateCustomBranch (user@remote.git#branch)
#Run lando info and check host in
# external_connection: {
# host: 'localhost',
# port: '32939'
# },
mail:
# Change the host according to the information above
# Must be checked in every start of the Dev Environment because the port change
# Or Change it to mail.YOUR_LANDO_APP_NAME.lndo.site like the example below
host: mail.chkilel.lndo.site
name: Adil Chehabi
address: chkilel@cheha.bi
driver: sendmail
# Red 0;31
# Light Red 1;31
# Green 0;32
# Light Green 1;32
# Brown/Orange 0;33
# Yellow 1;33
# Blue 0;34
# Light Blue 1;34
# Purple 0;35
# Light Purple 1;35
# Cyan 0;36
# Light Cyan 1;36
# Light Gray 0;37
# White 1;37
RED='\033[0;31m'
LGREEN='\033[1;32m'
LBLUE='\033[1;34m'
NC='\033[0m' # No Color
BOLD='\033[1m'
echo "\n${LBLUE}${BOLD}*************************************************${NC}\n"
echo "${LBLUE}${BOLD}| Making October CMS better for you development |${NC}\n"
echo "${LBLUE}${BOLD}*************************************************${NC}\n"
# 1. Update .gitignore
echo "\n${LGREEN}Updating .gitignore ...${NC}"
cp -iv ./.gitignore.dev ./.gitignore;
# 2. Update or remove .md files
echo "\n${LGREEN}Making some cleaning and updating README...${NC}"
rm README.md;
rm LICENSE;
rm CONTRIBUTING.md;
rm ISSUE_TEMPLATE.md;
rm CHANGELOG.md;
cp -fv ./README.md.dev ./README.md;
# 3. Switch to dev dependencies
# Note that this version is modified to work with OC-BOOTSTRAPPER
echo "\n${LGREEN}Updating composer.json to the DEV branch of ${LBLUE}October CMS${NC}"
cp -fv ./composer.json.dev ./composer.json;
# 4. Update october
# Composer command prefixed by land because I use a lando DevStack
echo "\n${LGREEN}Updating October CMS ${LBLUE}to the DEV branch${NC}\n"
lando composer update;
# 5. Remove demo theme & plugin
echo "\n${LGREEN}Removing DEMO theme${NC}"
lando php artisan october:fresh;
# 6. Generate public folder symlinks
# 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
echo "\n${LGREEN}Generate public folder ${LBLUE}symlinks${NC}\n"
echo "${LGREEN}Removing the old symlinked public directory...${NC}"
rm -rf public;
echo "${LBLUE}Done ;-)${NC}\n"
echo "\n${LBLUE}Regenerate the symlinked public directory...${NC}"
php artisan october:mirror public --relative;
echo "${LBLUE}Done ;-)${NC}\n"
# 7. Init a new git repo for my development
# Remove the old git repo ant initiate a new one
echo "\n${RED}${BOLD}**********************************************************${NC} \n"
echo "${RED}${BOLD}Do you want to initialize a new GIT REPO${NC} \n"
echo "${RED}${BOLD}BE careful, this can not be undone, do it if you are sure${NC} \n"
echo "${RED}${BOLD}**********************************************************${NC} \n"
read -p "Continue (yes/no)?" CONT
if [ "$CONT" = "yes" ]; then
echo "\n${RED}${BOLD}Initializing new repo ...${NC}";
rm -rf .git;
git init;
else
echo "${LGREEN}No change made to the repo";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment