roda sites do LocomotiveCMS localmente em minutos usando Wagon e Devstep (Docker)

At Akretion we really love the Locomotive CMS which powers this corporate website and some other of our websites.

But in a company where we already ask our collaborators to master Python, not everybody has the proper Ruby runtime locally nor is willing to clutter his computer with all the dependencies. This is where Docker and Devstep really shine. Here is how to hack a LocomotiveCMS in minutes using Wagon in Devstep;

You may first need to install Docker on your computer in case you have been living on another planet over the last months: https://docs.docker.com/installation/ Don’t forget to give your user the privilege to run Docker as it saves you from doing sudo everytime when using docker.

1) Install Devstep

install Desvtep (voodoo includes the Devstep image because it’s derived from it. But you should still install the client launcher). http://fgrehm.viewdocs.io/devstep/getting-started

2) Install Java in the Devstep image (LocomotiveCMS requires Java in yui-compressor)

docker run -ti fgrehm/devstep:v0.2.0 bin/bash
developer@aa5578cfaeff:/$ apt-get update
developer@aa5578cfaeff:/$ sudo apt-get install openjdk-7-jre

in an other terminal/tab; note the container id (here aa5578cfaeff from the container shell prompter) and commit the changed image:

docker commit aa5578cfaeff fgrehm/devstep:v0.2.0

That commit will allow us to have Java in all our future containers based on Devstep.

3) Clone an existing Wagon website (unless you want to create a new one and follow the doc).

For instance we will start a blog example from the official LocomotiveCMS tutorial

git clone git@github.com:locomotivecms/wisdom-for-wanderers.git
cd wisdom-for-wanderers

but because we are lazy we will go straight to the branch containing the final result:

git fetch origin chapter-4.2:chapter-4.2
git checkout chapter-4.2

and because this is no mission critical ERP, we even suggest living on the edge and changing the Gemfile to grab the latest Wagon from git. So you can make this change in the Gemfile:

-gem 'locomotivecms_wagon', '~> 1.4.0'
+gem 'locomotivecms_wagon', git: 'https://github.com/locomotivecms/wagon.git'

4) Start a Devstep container to run our website locally using Wagon:

make sure you are inside the wisdom-for-wanderers folder and do:

./devstep hack -p 3333:3333

(you may double check where you downloaded/installed the devstep client command)

By doing that, you will enter a new Devstep container where the Ruby Buildpack will fire and converge the dependencies specified in the Gemfile, including the Wagon too to run LocomotiveCMS locally.

5) start wagon and you are done!

bundle exec wagon serve

Now browse http://localhost:3333 and you should be able to see the LocomotiveCMS blog!

You can now hack the liquid templates in the app folder and the CSS/JS in the public folder and see the changes live (a cool plugin to use is LiveReload for Firefox for instance so you don’t even need to refresh the browser).

Read LocomotiveCMS documentation to learn more http://doc.locomotivecms.com/making-blog Eventually start the process from the initial branch of chapter 1 and walk through the different stages by switching branches and restarting wagon (no need to restart the Docker container itself).

Next Docker tutorial will teach you how to do magic with Docker and Odoo…

Sobre o autor

Founder
Raphaël Valyi
Founder - Brazil
Raphael, when he worked in Smile the French IT company, led the most thorough comparative study on ERP OpenSource (OpenERP, Openbravo, Compiere, Adempiere, ERP5 Ofbiz, etc ...) that led to writing a white paper of 120 pages. It has over 5 years experience in OpenERP and achieved more than 10 ...

Esse site usa cookies para melhorar a sua experiência de navegação