Deployment By Aswat

HOW TO THINK THE CODE ?

If you can modify the lifecycle of a web request, be careful


Follow the good practice

Bad ideas

Abuse of threads


Share data between requests, with calback, etc...

File system

A file system is POSIX on Linux


ACID


Non-concurrent operations


Bottleneck

File system is not a datastore

File System is the nightmare of ops

File System creates coupling (host provider/OS/language)

SPOF-free multi tenant File System doesn't exist

Use a Real Datastore (S3, Ceph, RiakCS)

Code

Can be Replicated

Stateless

Process

Data

Databases

Files

Sessions

Events

Code vs Data

Code is a mathematical function


Data is when you need memory

Bad practices

Write something on the fs for the next request


Store the informations near your code


Sessions in a file system are a bad idea

Consider more things as Data

User account

Users Data

Files

Sessions

Events

Data Qualification

What is this data ?

Near the others ?

Need redundancy ?

Need speed ?

USE MANY DATASTORES


And Trust your middleware

Events

User account created

send a confirmation mail

add this user in the statistics management

create a storage space


Events

Generally, everything is sequential


Good practice is to use a broker

Event broker

Use your event broker as an async manager

RabbitMQ

Celery

0MQ

Redis

Bad practices with event

Cron + FS is neither an event queue nor a job scheduler


Schedule action table in Database, and wait for a loading page to launch the request is a very bad idea

Choose the technology because you love it, not because it's easy to install on your computer

Logs

Stdout

Syslog

Events

HTTP

Dev send the logs


Ops manage the logs

Bad idea with logs

Logs in file need to be removed

Manage to serve assets from somewhere else

CDN

S3

a different domain name with the other asset

A Web App is not a script

Do not generate code files at run

Code deployment

Use Docker

Use Git

But no more deployment with FTP/RSYNC


NEVER HOTFIX ON SERVER

Build System

USE IT

composer

grunt

godep

DO NOT COMMIT AND SHIP DEPS

RUN YOUR APP WITHOUT WRITE PERM

Deployment is an atomic operation


It's like a compilation


Docker as an operating system builder

Always be at a clean state of the server/OS


Uptime of one year is not something to be proud


Statelessness is the key

Use env variables to define the configuration

Thank you

Create a presentation like this one
Share it on social medias
Share it on your own
Share it on social medias
Share it on your own

How to export your presentation

Please use Google Chrome to obtain the best export results.


How to export your presentation

Deployment by Aswat

by loictosser

63 views

Public - 9/7/15, 3:06 AM