There has to be a better way...
A New Deployment Process: Mina + CircleCI
Instead of keeping all our different servers up-to-date with the latest development tools, we’ve created an open-source gem called mina-circle that allows developers to leverage CircleCI containers, which are well maintained and easily configurable. Using CircleCI as a build server frees us from maintaining servers and dependencies. This makes it easy to have our source files compiled (and our tests run) every time we want to deploy on CircleCI.
To get started, add mina and mina-circle to your Gemfile:
source 'http://rubygems.org' gem 'mina' gem 'mina-circle'
Then go to your CircleCI Account Page and create an API token (if you don’t have one already). Create a new file named
.mina-circle.yml in your home directory, and add an entry for token:
To deploy, ensure in your project that you’ve set up the usual mina deployment configuration.
Leveraging Circle’s build artifacts, we are able to create a complete archive of the build. In the circle.yml file, we issue the command
tar --exclude=“.git node_modules” -czvf ~/artifact_example.tar.gz . which creates an archive of the current build (excluding git and node_modules).
Combined with Mina, our deployments are able to locate the build (first obtaining the build number) and download the archive during the “deployment” process. This allows us to bypass the production or staging environment dependency requirement! We then curl down the archive, unpack it, and our site lives on our environment without building the assets.
Using this approach frees up our environment requirements and makes the environment more secure with fewer headaches. No more updating node or waiting for npm to compile assets on our production or staging environments.
Give it a Try
So give it a try and feel free to submit your pull requests and issues to the repository. And one day, it’s on our radar to try this out using Docker containers as our development environments so that we could deploy those containers into production.