diff --git a/deploy/deploy.sh b/deploy/deploy.sh deleted file mode 100644 index e524231..0000000 --- a/deploy/deploy.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -export ANSIBLE_SSH_ARGS="-o ForwardAgent=yes" - -# Install dependencies -if ! which pip > /dev/null; then - echo "Installing pip (requires sudo password)" - sudo apt-get install python-pip || sudo easy_install pip -fi - -if ! which ansible > /dev/null; then - echo "Installing ansible (requires sudo password)" - sudo pip install ansible -fi - -cd $(dirname $0) -ansible-playbook deploy.yml -i hosts diff --git a/deploy/deploy.yml b/deploy/deploy.yml deleted file mode 100644 index 4afced7..0000000 --- a/deploy/deploy.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -- name: Deploy API - hosts: all:!localhost - remote_user: "{{ service_user }}" - gather_facts: no - vars_files: - - vars.yml - tasks: - - name: Deploy from git - action: > - git - repo="{{ repository_url }}" - dest="{{ projects_path }}" - accept_hostkey=True - notify: restart service - - - name: Setup bot config - copy: > - src=/opt/web/config/api.json - dest="{{ projects_path }}/config.json" - owner=web - group=web - mode=0644 - notify: restart service - - - name: Install NVM - action: > - git - repo="https://github.com/creationix/nvm" - dest="{{ nvm_path }}" - - - name: Make sure Node.js is installed and properly aliased - command: > - bash -c "source {{ nvm_script }} && nvm install {{ nodejs_version }} && nvm alias {{ project_name }} {{ nodejs_version }}" - register: nvm_result - changed_when: > - "already installed" not in nvm_result.stdout - notify: restart service - - - name: Install NPM dependencies and build assets - command: > - bash -c "source {{ nvm_script }} && nvm use {{ project_name }} && cd {{ projects_path }} && npm install" - notify: restart service - - - name: Setup Upstart config - template: > - src=templates/upstart.j2 - dest="/etc/init/{{ project_name }}.conf" - mode=664 - notify: restart service - - handlers: - - name: restart service - service: > - name={{ project_name }} - state=restarted diff --git a/deploy/hosts b/deploy/hosts deleted file mode 100644 index d5dd70d..0000000 --- a/deploy/hosts +++ /dev/null @@ -1 +0,0 @@ -koodiklinikka.fi diff --git a/deploy/templates/upstart.j2 b/deploy/templates/upstart.j2 deleted file mode 100644 index 3ae9685..0000000 --- a/deploy/templates/upstart.j2 +++ /dev/null @@ -1,12 +0,0 @@ -description "koodiklinikka.fi API" -author "Riku Rouvila " - -start on runlevel [2345] -stop on runlevel [016] - -respawn -respawn limit 10 5 -env NODE_ENV=production -exec su -s /bin/bash -c 'source {{ nvm_script }} && nvm use {{ project_name }} && cd {{ projects_path }} && exec "$0" "$@"' {{ service_user }} -- \ - node index.js \ - >> /var/log/{{ project_name }}.log 2>&1 diff --git a/deploy/vars.yml b/deploy/vars.yml deleted file mode 100644 index d331482..0000000 --- a/deploy/vars.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -project_name: koodiklinikka.fi-api -projects_path: /opt/web/koodiklinikka.fi-api -repository_url: git@github.com:koodiklinikka/koodiklinikka.fi-api.git -service_user: web -nvm_path: /opt/web/nvm -nvm_script: /opt/web/nvm/nvm.sh -nodejs_version: v0.10.25