A culture that emphasizes collaboration and communication between teams while automating the process of software delivery and infrastructure changes.
The summation of what everyone says and does.
More important than loops and queries
Not your productivity.
A methodology for building apps to be deployed on modern cloud platforms
Let's talk through some of the more important factors.
One codebase tracked in revision control
Explicitly declare and isolate dependencies
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs.
$ export NYCDA=nifty
$ echo $NYCDA
nifty
$ env | grep -i nyc
NYCDA=nifty
$ unset NYCDA
$ echo $NYCDA
$
$ cat env.rb
#!/usr/bin/env ruby
puts ENV['NYCDA']
$ ruby env.rb
nifty
Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run.
For you, your teammates, stage and production
You're gonna be working on more than one project at a time, what happens if they require different versions of Ruby, MySQL, Postgres, Python, etc?
FROM ruby:2.3.3
RUN apt-get update -qq && \
apt-get install -y build-essential libpq-dev nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN mkdir /rails-app
WORKDIR /rails-app
ADD Gemfile /rails-app/Gemfile
ADD Gemfile.lock /rails-app/Gemfile.lock
RUN bundle install
ADD . /rails-app
version: '2'
services:
db:
image: mysql:latest
env_file: .env
volumes:
- ./mysql-data/:/var/lib/mysql/
web:
build:
context: ./rails-app/
command: bundle exec rails s -p 3000 -b '0.0.0.0'
env_file: .env
environment:
MYSQL_HOST: db
volumes:
- ./rails-app/:/rails-app/
ports:
- "3000:3000"
depends_on:
- db
RAILS_ENV=docker-dev
MYSQL_PORT=3306
MYSQL_USER=your_user
MYSQL_PASSWORD=password
MYSQL_ROOT_PASSWORD=password
MYSQL_DATABASE=your_database
docker-dev:
<<: *default
database: <%= ENV['MYSQL_DATABASE'] %>
username: <%= ENV['MYSQL_USER'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>
host: <%= ENV['MYSQL_HOST'] %>
port: <%= ENV['MYSQL_PORT'] %>