SlideShare a Scribd company logo
Environment
Masters Academy, 2018
Environment
- Production environment
Environment
- Production environment
- General principles
Environment
- Production environment
- General principles
- Tools
Environment
- Production environment
- General principles
- Tools
- Docker
Environment
- Production environment
- General principles
- Tools
- Docker
- Docker Compose
Environment
- Production environment
- General principles
- Tools
- Docker
- Docker Compose
- Deployment Keys and Security
Environment - Production environment
- Setting where your product is actually put into operation for their intended
uses by end users
- Could be thought of as a real-time setting where programs are run hardware
setups are installed and relied on for organization or commercial daily
operations
- In testing environment a product is still being used theoretically. In the
production environment, the product has been delivered and needs to work
flawlessly
Environment - Production environment
- Code is frozen
- Services are high-stable
- All of possible cacheable things is cached
- Assets are precompiled
- Contains at least TWO servers:
- HTTP-server
- Web-server
- DB is being backed up regularly
- Virtual server is secured
Environment - General principles
Copy sourcesCreate dir for release Run bundle
Run DB migrationsPrecompile assets
Link “current” to the
new release
Unlink old symlink Restart Web Server Reset Cache
Environment - Tools
- Docker
- Docker Compose
Environment - Docker
VIRTUALIZATION CONTAINER
S
APP
GUEST OS
APP
GUEST OS
APP
GUEST OS
HYPERVISOR
HOST OPERATING SYSTEM
APP
SUPPORTING
FILES
RUNTIME
APP APP
SUPPORTING
FILES
RUNTIME
APP
HOST OPERATING SYSTEM
Environment - Docker
Process
Process
Process
LIB
Process
Process
Process
LIB
DOCKER ENGINE
OPERATING SYSTEM
Environment
Environment - Docker Compose
Dockerfile
FROM ruby:2.4
RUN apt-get update -qq && apt-get install -y curl apt-transport-https build-essential libpq-dev
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install
ADD . /app
Environment - Docker Compose
Native Docker Compose Based
- Database
- Redis
- Sidekiq
- Rails app
- Elasticsearch
- Code
Database
RedisSidekiq
Rails app
Elasticsearch
Code
Environment - Docker Compose
Project folder
app/
Gemfile
Gemfile.lock
Dockerfile
docker-compose.yml
Environment - Docker Compose
docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- 5432:5432
redis:
image: redis:4-alpine
ports:
- 6379:6379
web:
build: .
ports:
- 3000:3000
depends_on:
- redis
- db
WEB
REDIS
DB
Environment - Deployment Keys and Security
- Do not keep secret information in the repository
- Do not keep env files in the repository
- Do not use standard SSH ports
- Do not make your services open-for-world
- Disable remote access to your services
- Encrypt sensitive data
- Store sensitive data in the ENV
- Use secured SSL
Q & A

More Related Content

Environment