diff --git a/Makefile b/Makefile index d220670..bc6e8de 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ VERSION:=$(shell git describe --always) +TARGET_ENV=prod build: dist/personal-measure-api.tar.gz dist/personal-measure-web.tar.gz @@ -17,13 +18,15 @@ dist/personal-measure-web.tar.gz: deploy-api: dist/personal-measure-api.tar.gz mkdir -p temp-deploy/personal-measure-api-${VERSION} tar xzf dist/personal-measure-api-${VERSION}.tar.gz -C temp-deploy/personal-measure-api-${VERSION} - scp temp-deploy/personal-measure-api-${VERSION}/personal_measure_api pmapi@pmapi.jdbernard.com:/home/pmapi/personal_measure_api + -ssh pmapi@pmapi.jdb-labs.com "sudo systemctl stop personal_measure_api.$(TARGET_ENV).service" + scp temp-deploy/personal-measure-api-${VERSION}/personal_measure_api pmapi@pmapi.jdb-labs.com:/home/pmapi/$(TARGET_ENV)/personal_measure_api + ssh pmapi@pmapi.jdb-labs.com "sudo systemctl start personal_measure_api.$(TARGET_ENV).service" rm -r temp-deploy deploy-web: dist/personal-measure-web.tar.gz mkdir -p temp-deploy/personal-measure-web-${VERSION} tar xzf dist/personal-measure-web-${VERSION}.tar.gz -C temp-deploy/personal-measure-web-${VERSION} - aws s3 sync temp-deploy/personal-measure-web-${VERSION} s3://personal-measure.jdbernard.com + aws s3 sync temp-deploy/personal-measure-web-${VERSION} s3://pm.jdb-labs.com/$(TARGET_ENV)/webroot rm -r temp-deploy deploy: deploy-api deploy-web diff --git a/web/.env.production b/web/.env.production index 03d084a..67ce248 100644 --- a/web/.env.production +++ b/web/.env.production @@ -1,3 +1,3 @@ -VUE_APP_PM_API_BASE=https://personal-measure.jdb-labs.com/api +VUE_APP_PM_API_BASE=https://pm.jdb-labs.com/api VUE_APP_LOG_LEVEL=INFO VUE_APP_API_LOG_LEVEL=ERROR diff --git a/web/Makefile b/web/Makefile index f374aac..2581faa 100644 --- a/web/Makefile +++ b/web/Makefile @@ -1,4 +1,3 @@ -API_ADDR='localhost:8080' API_LOG_LEVEL='WARN' LOG_LEVEL='TRACE' diff --git a/web/package.json b/web/package.json index 246d4a1..9e8db47 100644 --- a/web/package.json +++ b/web/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build", + "build": "vue-cli-service build --mode production", "build-dev": "vue-cli-service build --mode development", "lint": "vue-cli-service lint", "test:unit": "vue-cli-service test:unit" diff --git a/web/src/app.ts b/web/src/app.ts index 31a2720..077083f 100644 --- a/web/src/app.ts +++ b/web/src/app.ts @@ -13,6 +13,7 @@ const logger = logService.getLogger('/app'); }) export default class App extends Vue { + public version = process.env.PM_VERSION; private apiLogAppender!: ApiLogAppender; private consoleLogAppender!: ConsoleLogAppender; diff --git a/web/src/components/measure-details/simple-details.ts b/web/src/components/measure-details/simple-details.ts index 84d7f91..a675154 100644 --- a/web/src/components/measure-details/simple-details.ts +++ b/web/src/components/measure-details/simple-details.ts @@ -12,7 +12,7 @@ export class SimpleDetails extends Vue { @Prop() private measure!: Measure; @Prop() private measurements!: Array>; - private newMeasurement; + // private newMeasurement; private moment = moment; private chartOptions = { noData: { text: 'no data', diff --git a/web/vue.config.js b/web/vue.config.js index c72f6fd..11e3fa8 100644 --- a/web/vue.config.js +++ b/web/vue.config.js @@ -1,3 +1,10 @@ +const merge = require('deepmerge'); +const VERSION = { + 'process.env': { + PM_VERSION: JSON.stringify(require('./package.json').version) + } +}; + module.exports = { devServer: { proxy: { @@ -17,5 +24,11 @@ module.exports = { analyzerMode: 'static', openAnalyzer: false } + }, + + chainWebpack: config => { + config + .plugin('define') + .tap(args => merge(args, [VERSION])) } };