Skip to content

Instantly share code, notes, and snippets.

@pmanijak
Last active August 29, 2015 14:00
Show Gist options
  • Save pmanijak/ab5b674d6d15b335d60f to your computer and use it in GitHub Desktop.
Save pmanijak/ab5b674d6d15b335d60f to your computer and use it in GitHub Desktop.
Circle Blvd: Deploy with git, precariously: http://circleblvd.org
1. Prerequisites (see below)
2. Set up the server
3. Set up the client
1. Set up Circle Blvd on Ubuntu: https://gist.github.com/exclsr/6cd72c7815e0ea1ab74e
2. Have a clone of https://github.com/secret-project/circle-blvd on your local machine
Things to understand:
-- This is for people comfortable with technical things
-- This isn't exactly a best practice, but it is a starting point.
# In your .ssh/config file
Host circle-blvd
HostName <domain or ip address>
User ubuntu
IdentiyFile <path to you your pem key>
# Go to your local repo first
# Set up an ssh profile
git remote add deploy circle-blvd:/home/ubuntu/repos/circle-blvd.git
git push deploy +master:refs/heads/master
# To use: git push deploy
mkdir -p ~/repos/circle-blvd.git
cd repos/circle-blvd.git
git init --bare
cd
chmod +x post-receive
cp post-receive ~/repos/circle-blvd.git/hooks/post-receive
#!/bin/bash
DEPLOY_DIR=/home/ubuntu/apps/circle-blvd
WORK_DIR=/home/ubuntu/working/circle-blvd
mkdir -p $WORK_DIR
# Throw away local changes
GIT_WORK_TREE=${WORK_DIR} git checkout -f
# Get dependencies
cd ${WORK_DIR}/app
npm install --production
# Move into production, precariously
rm -r ${DEPLOY_DIR}/*
# Move dotfiles, too
shopt -s dotglob nullglob
mv ${WORK_DIR}/app/* ${DEPLOY_DIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment