Skip to content

jcoyne/dockerizing_rails

 
 

Repository files navigation

Dockerizing Rails - A supercharged development process

Preparing for the workshop

Please make sure to install

Make sure to create a Docker ID if you don't have one already: https://hub.docker.com/signup

Clone this repository so that we can iterate on it later in the workshop:

git clone https://github.com/jcoyne/dockerizing_rails

Testing your Docker installation

Run the following command on you system:

docker version

The output of the command should look similar to this:

Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:26:49 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.8
  Git commit:       6a30dfc
  Built:            Thu Aug 29 05:32:21 2019
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

The important parts here are

Verifying Docker Compose version

Run the following command on you system:

docker-compose -v

The output of the command should look similar to this:

docker-compose version 1.24.1, build 4667896b

If you are running an older Version of Docker Compose or you are getting a command not found, please follow the installation instructions for Docker Compose: https://docs.docker.com/compose/install/

Pre-loading images

To save time and bandwidth throughout the workshop, I recommend that you download the container "images" that we will use beforehand. Don't worry if you don't know what an image is yet - we will go over that in the workshop. All you have to do is execute the following commands:

docker image pull ubuntu:18.04
docker image pull jfahrer/ruby:2.6.3-alpine3.10-ser
docker image pull redis:5.0
docker image pull postgres:10.6-alpine

The output will look similar to this:

2.6.3-alpine3.10-ser: Pulling from jfahrer/ruby
bdf0201b3a05: Pull complete
67a4a175230f: Pull complete
5b688ca58800: Pull complete
68bfb7317906: Pull complete
e95e2e8e402a: Pull complete
5e7827d9c7e8: Pull complete
4507d0429dd7: Pull complete
7cba2dc1349a: Pull complete
61e576b94017: Pull complete
951629f33eb5: Pull complete
Digest: sha256:b1a4210e93b94e5a09a6e9c8f44c8f0a2aef03c520d6268faa20261c55d6d2b7
Status: Downloaded newer image for jfahrer/ruby:2.6.3-alpine3.10-ser

Assignments

Throughout the workshop you will complete the following assignments:

TLDR - I just want to see a dockerized Rails app

Check out the dockerized branch and run script/setup to start the application.

Learning more

Additional topics

There are more topics that didn't quite fit into the workshop.

  • Running the application as a different user
  • Advanced caching mechanisms for gems and libraries
  • Making use of environment variables to change the development environment
  • Integration testing with Capybara/Cypress
  • Utilizing CI/CD
  • Preparing your image for production
  • Deploying to Kubernetes And much more.

Sign up at RailsWithDocker.com and Julian will shoot you an email as soon as the material is ready.

Resources

Doing more

Nothing better than practicing your newly acquired skills. I suggest that you dockerize one of you applications or extend the demo app with some additional functionality. Here are some ideas:

  • Paginate activities and todos
  • Add a filter to display archived todos: There is currently no way to show archived todos
  • Add a search engine: Use Elasticsearch, Solr, or another searchengine to make todos searchable
  • Soft delete todos: We currently allow users to delete todos from the database
  • Add a Sidekiq monitor (https://github.com/mperham/sidekiq/wiki/Monitoring): Try to run the monitor in as its own Rack app in its own container

Contributions

Course developed by Julian Fahrer @jfahrer and presented at RailsConf 2019. Special thanks to @hjhart and @palexvs for all their help with this workshop.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 77.7%
  • HTML 15.2%
  • JavaScript 3.3%
  • Shell 2.0%
  • CSS 1.8%