Allow targeting different environments with deply. Add version string on the web App component.

This commit is contained in:
Jonathan Bernard 2019-05-19 01:28:02 -05:00
parent 4bc8c00c49
commit 30ced3ecfd
7 changed files with 22 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,3 @@
API_ADDR='localhost:8080'
API_LOG_LEVEL='WARN'
LOG_LEVEL='TRACE'

View File

@ -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"

View File

@ -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;

View File

@ -12,7 +12,7 @@ export class SimpleDetails extends Vue {
@Prop() private measure!: Measure<MeasureConfig>;
@Prop() private measurements!: Array<Measurement<MeasurementMeta>>;
private newMeasurement;
// private newMeasurement;
private moment = moment;
private chartOptions = {
noData: { text: 'no data',

View File

@ -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]))
}
};