Skip to content

Commit

Permalink
Merge pull request #267 from FroggyTaipei/staging
Browse files Browse the repository at this point in the history
Release 1.0.7 on release
  • Loading branch information
travishen authored Dec 23, 2019
2 parents 47e4555 + 054a292 commit d16e01e
Show file tree
Hide file tree
Showing 23 changed files with 549 additions and 478 deletions.
40 changes: 3 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,15 @@ Use `-v` to clean volume while stop containers:
$ docker-compose down -v
```

Run production:
```
$ docker-compose -f docker-compose-prod.yml up
$ docker-compose -f docker-compose-prod.yml down
```

Base on your operating system, **missing bindings** might happen:
```
$ docker-compose up
...
Node Sass could not find a binding for your current environment: Linux/musl 64-bit with Node.js 10.x
```
Try mounting container's node_module to volume with a different name,
e.g. changing `docker-compose.yml`:
```yaml
volumes:
node_modules_volume:

frontend:
image: node:10-alpine
command: npm run serve
volumes:
- ./.env:/app/.env:ro
- ./frontend:/app
- node_modules_volume:/usr/src/app/node_modules
working_dir: /app
restart: on-failure
```
See: [Docker ALPINE Linux throws node-sass missing binding error](https://github.com/sass/node-sass/issues/2165)
### Deploy

Run the app in Kubernetes
The folder k8s-specifications contains the yaml specifications of the App's services.
First create the app namespace
```
$ kubectl create namespace app
```
The folder k8s-specifications contains the yaml specifications, this is for demo purpose, note the persistent volume
is not set for database.

Create secrets
```
$ kubectl create secret generic environs --from-env-file .env --namespace app
$ kubectl create secret generic environs --from-env-file .env
```

Run the following command to create the deployments and services objects:
Expand Down
8 changes: 5 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ ENV PYTHONFAULTHANDLER=1 \
RUN apt-get update \
&& apt-get install -y gettext libgettextpo-dev

COPY . /app

WORKDIR /app

RUN pip install -r ./requirements.txt
COPY requirements.txt .

RUN pip install -r requirements.txt

COPY . .
4 changes: 2 additions & 2 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Django==2.2.4
Django==2.2.8
django-environ==0.4.5
django-extensions==2.1.6
flake8==3.5.0
gevent==1.3.6
gunicorn==19.9.0
Pillow==5.0.0
Pillow==6.2.0
psycopg2-binary==2.7.5
requests==2.20.0
raven==6.9.0
Expand Down
41 changes: 0 additions & 41 deletions docker-compose-prod.yml

This file was deleted.

1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
volumes:
- ./.env:/app/.env:ro
- ./frontend:/app
- /app/node_modules
working_dir: /app
restart: on-failure

Expand Down
6 changes: 3 additions & 3 deletions docker_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if [ "$TRAVIS_BRANCH" == "release" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; t
# Build and push to GCR
sudo cp .env.prod .env
build_and_push_image ${RELEASE_API} ${TRAVIS_COMMIT} backend/Dockerfile ./backend
build_and_push_image ${RELEASE_NGINX} ${TRAVIS_COMMIT} nginx/k8s.Dockerfile .
build_and_push_image ${RELEASE_NGINX} ${TRAVIS_COMMIT} nginx/Dockerfile .

# Release deployment update
kubectl set image deployment/${API_DEPLOYMENT} ${API_CONTAINER}=${RELEASE_API}:${TRAVIS_COMMIT};
Expand All @@ -47,7 +47,7 @@ if [ "$TRAVIS_BRANCH" == "staging" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; t
# Build and push to GCR
sudo cp .env.stage .env
build_and_push_image ${STAGE_API} ${TRAVIS_COMMIT} backend/Dockerfile ./backend
build_and_push_image ${STAGE_NGINX} ${TRAVIS_COMMIT} nginx/k8s.Dockerfile .
build_and_push_image ${STAGE_NGINX} ${TRAVIS_COMMIT} nginx/Dockerfile .

# Deploy
kubectl set image deployment/${API_DEPLOYMENT} --namespace=stage ${API_CONTAINER}=${STAGE_API}:${TRAVIS_COMMIT};
Expand All @@ -61,5 +61,5 @@ if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; th
# Build and push to DockerHub
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}";
build_and_push_image ${PUBLIC_API} ${TRAVIS_COMMIT} backend/Dockerfile ./backend
build_and_push_image ${PUBLIC_NGINX} ${TRAVIS_COMMIT} nginx/k8s.Dockerfile .
build_and_push_image ${PUBLIC_NGINX} ${TRAVIS_COMMIT} nginx/Dockerfile .
fi
2 changes: 0 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
"babel-jest": "^23.4.2",
"compression-webpack-plugin": "^2.0.0",
"node-sass": "^4.9.3",
"pug": "^2.0.3",
"pug-plain-loader": "^1.0.0",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.5.17"
},
Expand Down
119 changes: 71 additions & 48 deletions frontend/src/components/About.vue
Original file line number Diff line number Diff line change
@@ -1,64 +1,87 @@
<template lang="pug">
el-container(style="align-items: center;").page3
transition(name="fade" @after-leave="redirect")
el-row.about-main(type="flex" align="middle" justify="center" style="max-width: 1024px" v-show="showMainContent")
el-col.about-title-wrapper(:span=22)
.about-title 公開透明。
el-col.about-content-wrapper(:span=22)
el-row(type="flex" align="middle" justify="center")
el-col.noScrollbar(:span=15 :sm="24" :xs="24" style="height: 100%;")
article
.about-content
span 口號喊了十幾年,政治仍然跟人心一樣複雜。
br
br
span 密室的會談,檯面下的交換。我們用作秀來度量政治的專業,用喬事的廣度來判斷代議士服務的態度。要杜絕喬罰單與床位這類弊病,選民服務應該要和市政質詢一樣,可以被公開監督。
br
br
span 「選服魔鏡號」是我的政見。只要你生活在台北市,你的意見、你覺得政府該做而沒做好、或是不知道該請誰幫忙的,都可以找我們協助。
br
br
span 但,只關乎個人利益的,我們不碰;不屬於民代職權的,我們不做!
br
br
span 我的團隊會在收到案件後進行隱私處理,並在第一時間向全體市民公布:一個市議員,到底做了什麼、又應該做些什麼?
br
br
span 這是「民主開箱」第一步,未來四年,我們繼續前進!
br
img.signImg(:src="froggySignUrl")
el-col.hidden-xs-only(:span=8 :offset=1)
img.froggyServantImg( :src="froggyAboutUrl" )
BottomGameDialog(:title="aboutTitle")
<template>
<el-container class="page3" style="align-items: center;">
<transition name="fade" @after-leave="redirect">
<el-row
class="about-main"
type="flex"
align="middle"
justify="center"
style="max-width: 1024px;"
v-show="showMainContent"
>
<el-col class="about-title-wrapper" :span="22">
<div class="about-title">公開透明。</div>
</el-col>
<el-col class="about-content-wrapper" :span="22">
<el-row type="flex" align="middle" justify="center">
<el-col class="noScrollbar" :span="15" :sm="24" :xs="24" style="height: 100%;">
<article>
<div class="about-content">
<span>口號喊了十幾年,政治仍然跟人心一樣複雜。</span>
<br />
<br />
<span>密室的會談,檯面下的交換。我們用作秀來度量政治的專業,用喬事的廣度來判斷代議士服務的態度。要杜絕喬罰單與床位這類弊病,選民服務應該要和市政質詢一樣,可以被公開監督。</span>
<br />
<br />
<span>「選服魔鏡號」是我的政見。只要你生活在台北市,你的意見、你覺得政府該做而沒做好、或是不知道該請誰幫忙的,都可以找我們協助。</span>
<br />
<br />
<span>但,只關乎個人利益的,我們不碰;不屬於民代職權的,我們不做!</span>
<br />
<br />
<span>我的團隊會在收到案件後進行隱私處理,並在第一時間向全體市民公布:一個市議員,到底做了什麼、又應該做些什麼?</span>
<br />
<br />
<span>這是「民主開箱」第一步,未來四年,我們繼續前進!</span>
<br />
</div>
</article>
<img class="signImg" :src="froggySignUrl" />
</el-col>
<el-col class="hidden-xs-only" :span="8" :offset="1">
<img class="froggyServantImg" :src="froggyAboutUrl" />
</el-col>
</el-row>
</el-col>
</el-row>
</transition>
<BottomGameDialog :title="aboutTitle"></BottomGameDialog>
</el-container>
</template>

<script>
import BottomGameDialog from './BottomGameDialog.vue'
import BottomGameDialog from "./BottomGameDialog.vue";
export default {
name: 'About',
name: "About",
components: { BottomGameDialog },
data: function () {
data: function() {
return {
showMainContent: false,
aboutTitle: ['「選民魔鏡號,市民看得到!」-台北市議員邱威傑市民服務系統⋯⋯', '不要再點了,上面我說的話好好看!'],
froggyservantUrl: 'https://storage.googleapis.com/froggy-service/frontend/images/about/froggy_servant.png',
froggyAboutUrl: 'https://storage.googleapis.com/froggy-service/frontend/images/about/g2-2_s_center.png',
froggySignUrl: 'https://storage.googleapis.com/froggy-service/frontend/images/about/froggy_sign_s.png'
}
aboutTitle: [
"「選民魔鏡號,市民看得到!」-台北市議員邱威傑市民服務系統⋯⋯",
"不要再點了,上面我說的話好好看!"
],
froggyservantUrl:
"https://storage.googleapis.com/froggy-service/frontend/images/about/froggy_servant.png",
froggyAboutUrl:
"https://storage.googleapis.com/froggy-service/frontend/images/about/g2-2_s_center.png",
froggySignUrl:
"https://storage.googleapis.com/froggy-service/frontend/images/about/froggy_sign_s.png"
};
},
mounted () {
this.showMainContent = true
mounted() {
this.showMainContent = true;
},
methods: {
toggleLeaveAnimation: function (destination) {
this.showMainContent = false
toggleLeaveAnimation: function(destination) {
this.showMainContent = false;
},
redirect: function () {
let direction = this.$store.state.redirectTo
this.$router.push(direction)
redirect: function() {
let direction = this.$store.state.redirectTo;
this.$router.push(direction);
}
}
}
};
</script>

<style lang="sass" scoped>
Expand Down
Loading

0 comments on commit d16e01e

Please sign in to comment.