hi there, - 2016.antwerp.wordcamp.org · hi there, i'm mark (with a k) dad, front-end lover,...

12
HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast

Upload: others

Post on 18-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

HI THERE,

I'M MARK (WITH A K)Dad, Front-end lover, author, teacher, WordPress enthousiast

Page 2: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

WORDPRESS DEPLOYMENTWITH GIT

HOW TO KILL YOUR FTP HABITS.

Page 3: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

WHY YOU SHOULD CONSIDER SWITCHING TO GIT(AS DEPLOYMENT TOOL)

FTP (File Transfer Protocol)

Slower -> 2 connectionsHuman actionsManual Cherrypickupdates

GIT (code version control)

1 way connection -> UPAutomated actionsOnly deploy changesIt's 2016

Page 4: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

IS GIT REALY FASTER?Based on a small (4 pages, with pictures) WordPress website

FTP (File Transfer Protocol) GIT (code version control)

That's whopping ~95% faster

Page 5: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

GIT FOR THE WIN

Page 6: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

TO GET STARTED WITH GIT DEPLOYMENT:Project code in GIT (duh)Server with SSH accessGIT should be enabled on remote server (default)

Page 7: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

SERVER - HOW TO?ssh user@domain

cd /var/mkdir git/

cd git/ mkdir project_name.git

cd project_name.git git init --bare Initialised empty Git repository in /var/git/project_name.git/

cd /hooks/ nano post-receive

#!/bin/bash while read oldrev newrev ref do echo "Master ref received. Deploying master branch to production..." GIT_WORK_TREE=/var/www/project_name/apps/default git checkout -f done

chmod +x post-receive

Page 8: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

LOCAL - HOW TO?cd projects/project_name

git remote add production ↵ ssh://user@domain/var/www/project_name/git/project_name.git

git push production +master:refs/heads/master

production, you can name it anything you want.

Page 9: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

DEPLOYING CODEWORKFLOW

Each time that you make changes to your code, commit themas usual

git add . git add file.php

git commit -m "explaining the feature or fix"

git push

And then run the following command to deploy your changesto the remote server:

git push production master

Page 10: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

THE MAIN FORMAT OF THE COMMAND:git push 'chosen name for remote server' 'branch name'

git push staging staging

git push alpha feature

git push production master

Page 11: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

?QUESTIONS?

Page 12: HI THERE, - 2016.antwerp.wordcamp.org · HI THERE, I'M MARK (WITH A K) Dad, Front-end lover, author, teacher, WordPress enthousiast. WORDPRESS DEPLOYMENT WITH GIT HOW TO KILL YOUR

WORDPRESS DEPLOYMENT WITH GITMARK CREETEN

@MARK_WITH_A_K

APPSALOON IS HIRING!