diff --git a/deploy/playbooks/deploy.yml b/deploy/playbooks/deploy.yml new file mode 100644 index 0000000..859a437 --- /dev/null +++ b/deploy/playbooks/deploy.yml @@ -0,0 +1,15 @@ +--- +- name: Deploy impress-2020 from `main` on GitHub + hosts: webserver + tasks: + - name: Pull impress-2020 from `main` on GitHub + git: + repo: https://github.com/matchu/impress-2020.git + dest: /srv/impress-2020/latest-version + version: main + - name: Install dependencies with yarn + command: + chdir: /srv/impress-2020/latest-version + cmd: yarn install + register: result + changed_when: '"Already up-to-date." not in result.stdout' diff --git a/deploy/setup.yml b/deploy/playbooks/setup.yml similarity index 70% rename from deploy/setup.yml rename to deploy/playbooks/setup.yml index d6e9dd8..3e7f25b 100644 --- a/deploy/setup.yml +++ b/deploy/playbooks/setup.yml @@ -1,5 +1,5 @@ --- -- name: Install the impress-2020 app +- name: Set up the environment for the impress-2020 app hosts: webserver tasks: - name: Create web user group @@ -36,3 +36,19 @@ update_cache: yes name: nodejs state: present + - name: Install Yarn + become: yes + npm: + name: yarn + global: yes + - name: Install node-canvas dependencies + become: yes + apt: + update_cache: yes + name: + - build-essential + - libcairo2-dev + - libpango1.0-dev + - libjpeg-dev + - libgif-dev + - librsvg2-dev diff --git a/package.json b/package.json index 6be42b8..1b285df 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,8 @@ "vercel-build": "yum install libuuid-devel libmount-devel && cp /lib64/{libuuid,libmount,libblkid}.so.1 node_modules/canvas/build/Release/", "test": "jest test --env=jsdom", "lint": "next lint --dir src --dir pages", - "deploy-setup": "echo $'Setup requires you to become the root user. You\\'ll need to enter the password for your account on the remote web server below, and you must be part of the `sudoers` user group.' && ansible-playbook -K -i deploy/inventory.cfg deploy/setup.yml", + "deploy-setup": "echo $'Setup requires you to become the root user. You\\'ll need to enter the password for your account on the remote web server below, and you must be part of the `sudoers` user group.' && ansible-playbook -K -i deploy/inventory.cfg deploy/playbooks/setup.yml", + "deploy": "ansible-playbook -i deploy/inventory.cfg deploy/playbooks/deploy.yml", "cypress": "cypress open", "mysql": "mysql --host=impress.openneo.net --user=$(dotenv -p IMPRESS_MYSQL_USER) --password=$(dotenv -p IMPRESS_MYSQL_PASSWORD) --database=openneo_impress", "mysql-dev": "mysql --host=localhost --user=impress_2020_dev --password=impress_2020_dev --database=impress_2020_dev",