From b656adc23d9da2c6a0dbbdd78cd4993e28cc7ad8 Mon Sep 17 00:00:00 2001 From: tmont Date: Mon, 27 Apr 2020 21:14:33 -0700 Subject: [PATCH] deployment stuff --- .gitignore | 2 +- .nvmrc | 1 + deploy.sh | 4 ++++ generate.js | 2 +- package.json | 4 +++- update.sh | 24 ++++++++++++++++++++++++ 6 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .nvmrc create mode 100755 deploy.sh create mode 100755 update.sh diff --git a/.gitignore b/.gitignore index e4ae581..71ca7e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .idea node_modules public/ - +COVID-19/ diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..d494f46 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +12.16.2 diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..028e3ad --- /dev/null +++ b/deploy.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +scp -r ./data ./tmpl generate.js update.sh package.json yarn.lock .nvmrc \ + tmont.com:/var/www/sites/covid19.tmont.com diff --git a/generate.js b/generate.js index 0f50c33..f4379f1 100755 --- a/generate.js +++ b/generate.js @@ -8,7 +8,7 @@ const pug = require('pug'); const publicDir = path.join(__dirname, 'public'); const templatesDir = path.join(__dirname, 'tmpl'); const dataDir = path.join(__dirname, 'data'); -const covidDataDir = path.resolve(path.join(__dirname, '..', 'COVID-19', 'csse_covid_19_data')); +const covidDataDir = path.resolve(path.join(__dirname, 'COVID-19', 'csse_covid_19_data')); const timeSeriesDir = path.join(covidDataDir, 'csse_covid_19_time_series'); const promiseMe = (fn) => { diff --git a/package.json b/package.json index 50fb37c..057abec 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "bootstrap": "4.4.1", "chart.js": "2.9.3", "csv-parse": "4.8.9", - "pug": "2.0.4", + "pug": "2.0.4" + }, + "devDependencies": { "serve": "11.3.0" } } diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..155a6c7 --- /dev/null +++ b/update.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cd "${dir}" + +. /home/tmont/.nvm/nvm.sh +nvm use +yarn install --production --non-interactive --pure-lockfile + +if [[ ! -d "./COVID-19" ]]; then + git clone --depth 1 https://github.com/CSSEGISandData/COVID-19.git +else + (cd COVID-19 && git pull) +fi + +rm -rf ./public/ +./generate.js + +rsync -va ./public/ ./live/ +echo $(date) +echo