Skip to content

Instantly share code, notes, and snippets.

@btc
Created January 26, 2015 11:23
Show Gist options
  • Save btc/a201cb59d6a229504682 to your computer and use it in GitHub Desktop.
Save btc/a201cb59d6a229504682 to your computer and use it in GitHub Desktop.
all:
#no-op
bootstrap: ansible
jenkins:
. venv/bin/activate && ./ansible/bin/ansible-playbook ci.yml --extra-vars "jenkins_slave_username=slave jenkins_slave_password=$(JENKINS_SLAVE_PASS)"
logs: activate ./ansible/bin/ansible
. venv/bin/activate && ./ansible/bin/ansible solarnet -m fetch -a "src=/ipfs/ipfs_master/repo/logs/events.log dest=."
cake: activate ./ansible/bin/ansible-playbook
. venv/bin/activate && ./ansible/bin/ansible-playbook ./playbooks/ipfs_update.yaml
make cake_no_update
cake_no_update: activate ./ansible/bin/ansible-playbook
. venv/bin/activate && ./ansible/bin/ansible-playbook ./playbooks/ipfs_kill_masters.yaml
. venv/bin/activate && ./ansible/bin/ansible-playbook ./playbooks/ipfs_kill.yaml
. venv/bin/activate && ./ansible/bin/ansible-playbook ./playbooks/ipfs_run_masters.yaml
. venv/bin/activate && ./ansible/bin/ansible-playbook ./playbooks/ipfs_run.yaml
cake_with_git: activate ./ansible/bin/ansible-playbook check-git-ref
. venv/bin/activate && ./ansible/bin/ansible-playbook --extra-vars "git_ref=$(GIT_REF)" ./playbooks/ipfs_update_git.yaml
make cake_no_update
CANARY_REF_SRC = versions/canary:go-ipfs
canary_update_git_ref:
git ls-remote -q git@github.com:jbenet/go-ipfs.git master | awk "{print \$$1}" > $(CANARY_REF_SRC)
canarynet_deploy : GIT_REF = $(shell cat $(CANARY_REF_SRC))
canarynet_deploy: activate ./ansible/bin/ansible-playbook
. venv/bin/activate && ./ansible/bin/ansible-playbook --extra-vars "git_ref=$(GIT_REF)" ./playbooks/canarynet_ipfs_deploy.yaml
gateway_update_image : GIT_REF = bbcaca01d44982f73fcec6fd4c0c1c0eb4f50a03
gateway_update_image: activate ./ansible/bin/ansible-playbook
. venv/bin/activate && ./ansible/bin/ansible-playbook --extra-vars "git_ref=$(GIT_REF)" ./playbooks/gateway_fs_update_git.yaml
gateway_deploy:
. venv/bin/activate && ./ansible/bin/ansible-playbook ./playbooks/deploy_gateway_fs.yaml
check-git-ref:
ifndef GIT_REF
$(error GIT_REF is undefined. it should be a valid git ref in http://github.com/jbenet/go-ipfs)
endif
./ansible/bin/ansible: ansible
./ansible/bin/ansible-playbook: ansible
ansible:
git clone git@github.com:ansible/ansible.git --recursive
activate: venv/bin/activate
.PHONY: venv/bin/activate
venv/bin/activate: requirements.txt
test -d venv || virtualenv venv
. venv/bin/activate && pip install -r requirements.txt
touch venv/bin/activate
# This section pertains to the IPFS WebUI
# webui_update compiles and rsyncs the assets given by WEBUI_GIT_REF to solarnet
# assets are uploaded into a directory named by the WEBUI_GIT_REF, so all previous
# versions of assets are kept and served.
#
# WEBUI_GIT_REF should match what's presently deployed
WEBUI_REPO = ./build/ipfs-webui # TODO add to .gitignore
WEBUI_BUILD_DIR = build/ipfs-webui/build
WEBUI_GULP = ./build/ipfs-webui/node_modules/.bin/gulp
WEBUI_GIT_REF = b4923e2148ab593dbc151282846e6fef083989df
webui_update: activate ./ansible/bin/ansible-playbook webui_compile
. venv/bin/activate && ./ansible/bin/ansible-playbook --extra-vars "git_ref=$(WEBUI_GIT_REF) webui_build_dir=$(shell pwd)/$(WEBUI_BUILD_DIR)" ./playbooks/webui_deploy.yaml
webui_compile: $(WEBUI_REPO) $(WEBUI_GULP)
git -C $(WEBUI_REPO) fetch
git -C $(WEBUI_REPO) checkout $(WEBUI_GIT_REF)
cd $(WEBUI_REPO) && npm install
cd $(WEBUI_REPO) && ./node_modules/.bin/gulp compile
$(WEBUI_REPO):
git clone git@github.com:mappum/ipfs-webui.git $(WEBUI_REPO)
#
# ROUTING
#
GRANDCENTRAL_ETCD_REF_SRC = versions/grandcentral:etcd
grandcentral_etcd_update_ref:
git ls-remote -q git@github.com:coreos/etcd.git master | awk "{print \$$1}" > $(GRANDCENTRAL_ETCD_REF_SRC)
grandcentral_etcd_deploy : GIT_REF = $(shell cat $(GRANDCENTRAL_ETCD_REF_SRC))
grandcentral_etcd_deploy: activate ./ansible/bin/ansible-playbook
. venv/bin/activate && ./ansible/bin/ansible-playbook --extra-vars "git_ref=$(GIT_REF)" ./playbooks/grandcentral_etcd_deploy.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment