Craft is awesome! Setup, deployment and maintenance isn't. Until now.
If you're already familiar with Craft you know it's simply the best CMS available today. But it's a bit of a painful process to set a new site up, get a server ready with everything it needs and deploy the site making sure everything works. An even more painful task is trying to maintain the site in the future and add new features once your client has gone and added many new entries and assets.... until now.
Wouldn't it be awesome to have an easy, quick, replicable system that enables you to setup a new Craft CMS sites in literally no time.
Complete with Gulp tasks that make local development a breeze. That includes a fast, secure and economic DigitalOcean droplet setup complete with both staging and production sites and all Craft server requirements. And have a simple, repeatable and secure deployment system with Capistrano. So deployment the first time and any time in the future is easy and syncing files and databases between server and local sites is trivial when it comes to maintenance.
Well I thought so. So, building on-top of the work of many others I have put together a repeatable process for Craft setup that takes you from an empty folder to a fully maintainable site, working on a staging and live server in under 15 minutes.
Here are just a few of the things this process includes.
Initial site setup
- One line bash install script.
- Installs the latest version of Craft.
- Out of the box multi-environment configuration with environment variables.
- Main layout file based on Html5 Boilerplate.
- Automatic build of site assets and switching between production and development versions depending on environment.
- jQuery installed out of the box but easy to remove.
- Setup to run locally with Laravel Homestead if desired.
Helpful Gulp build tasks
- Comes with Browsersync with auto reload on file change for fast development and ability to view development site on any device on the same network.
- SCSS build tasks including sourcemaps, linting, autoprefixing and automatic minification for production deployments.
- Ability to include as much or as little of the Bootstrap CSS library as you need with easy access to Bootstrap variables for quick customisation.
- JS build tasks including easy file includes, linting and automatic minification for production deployments.
- Ability to include as much or as little of the Bootstrap JS library modules as you need.
- Automatic image optimisation.
Secure server setup
- Customised especially for quick and secure DigitalOcean LEMP (Nginx) droplet setup.
- One line bash install script steps you through setup process quickly and easily.
- Sets up both production and staging sites automatically.
- Configures PHP, Nginx, file structure, permissions and installs and activates necessary Craft libraries automatically.
- Creates a "deploy" user and fully configures secure ssh connection for easy and secure deployment.
- For security removes "root" access.
- Steps you through database creation with SequelPro.
Easy Capistrano deployment
- Extended from Bluegg's craft-deploy with a few added extras.
- Super easy one line setup and deployment to staging and production environments.
- Comes with database backup syncing tasks to sync local to server, and server to local.
- Asset syncing tasks with rsync to easily sync uploaded assets between environments for easy maintainability.
- Using Capistrano also has the advantage that every single deployment predictable, repeatable and very easily reversible. No more crossing your fingers and hoping it works.
- Node & NPM installed locally.
- Ruby installed locally.
- wget installed locally.
- command-line access to mysqldump locally.
- SequelPro for database configuration.
- Mac only! This process was designed from the ground up to work within the OSX environment only. If you're running from Windows, this is not the code you're looking for. Use at your own risk.
The best thing is you can easily customise everything to your requirements.
All this is based on my preferences and I think is a great starting point. However, you may have your own preferences and that's fine. I'll walk you through how it's all put together and if you want to do things a different way you can just fork my git repository and customise the process to your needs.
What you'll get.
1. On local site setup and the Gulp tasks.
- A written step by step, detailed instruction guide stepping you through the process of how to setup a local site, a secure server and automated deployment in under 15 minutes.
- A one page quick-start guide as a handy reference.
- Three videos.
2. On DigitalOcean droplet server setup.
3. On Capistrano deployment.
- Plus one bonus video showing entire process from start to finish in under 15 minutes.
Note: This does not cover how to actually develop sites with Craft.
So if you want to save hours and hours on setup time, have a repeatable and secure system for deploying Craft sites, successfully deploy Craft sites every time and never dread maintenance of existing sites again then lets get started.