Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit eb096d2

Browse files
afshin-paydarmorteza-binarynazaninreihaniashkanx
authored
Afshin/add circleci pipeline (#1346)
* Preparing V2.5.1 (#1345) * make digits contract's barrier to be integer * New translations en.json (Italian) * New translations en.json (Italian) * update shelljs * fix buy * use buy instead of portfolio to fix chart hang when tick is 1 * remove subscribing to buy as it is unnecessary * fix missing profit/loss and sell_price in transaction details (#1323) * fix average becoming NaN in Asian trade (#1324) * update lodash (#1325) * Fix sending not shown in authorize as token (#1326) * Fix sending not shown in authorize as token * remove saved token after logout * Changed app icon * Morteza/new_app_icon (#1327) * Preparing version 2.4.5 (#1319) * make digits contract's barrier to be integer * New translations en.json (Italian) * New translations en.json (Italian) * V2.4.5 * Changed app icon * New translations en.json (Italian) * Fix self exclusion time and date fields * refactor * fixes to self exclusion * fix eslint * not validate exclude until when user has set it already * fix exclude until error and make it show the correct time user selected * Change 30 to 50 max chars for first name and last name * New translations en.json (Vietnamese) * New translations en.json (Vietnamese) * New translations en.json (Chinese Simplified) * New translations en.json (Chinese Traditional) * New translations en.json (French) * New translations en.json (German) * New translations en.json (Indonesian) * New translations en.json (Italian) * New translations en.json (Polish) * New translations en.json (Portuguese) * New translations en.json (Russian) * New translations en.json (Spanish) * New translations en.json (Thai) * New translations en.json (Acholi) * New translations en.json (Indonesian) * New translations en.json (Indonesian) * New translations en.json (Chinese Simplified) * New translations en.json (Chinese Simplified) * New translations en.json (Chinese Traditional) * New translations en.json (Spanish) * New translations en.json (Spanish) * New translations en.json (Polish) * New translations en.json (Polish) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Portuguese) * New translations en.json (Vietnamese) * New translations en.json (Russian) * New translations en.json (Thai) * New translations en.json (French) * New translations en.json (French) * New Crowdin translations (#1335) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * Dev (#1336) * Preparing version 2.4.5 (#1319) * make digits contract's barrier to be integer * New translations en.json (Italian) * New translations en.json (Italian) * V2.4.5 * Changed app icon * Preparing V2.4.6 (#1328) * make digits contract's barrier to be integer * New translations en.json (Italian) * New translations en.json (Italian) * update shelljs * fix buy * use buy instead of portfolio to fix chart hang when tick is 1 * remove subscribing to buy as it is unnecessary * fix missing profit/loss and sell_price in transaction details (#1323) * fix average becoming NaN in Asian trade (#1324) * update lodash (#1325) * Fix sending not shown in authorize as token (#1326) * Fix sending not shown in authorize as token * remove saved token after logout * Morteza/new_app_icon (#1327) * Preparing version 2.4.5 (#1319) * make digits contract's barrier to be integer * New translations en.json (Italian) * New translations en.json (Italian) * V2.4.5 * Changed app icon * V2.4.6 * Support synthetic_index * Add sythetic_indices to translation file * Fixed the issue of wrong contract response. * Fixed the issue adding cert with new version of shelljs * New Crowdin translations (#1338) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Chinese Simplified) * New translations en.json (Chinese Traditional) * New translations en.json (French) * New translations en.json (Indonesian) * New translations en.json (Italian) * New translations en.json (Polish) * New translations en.json (Portuguese) * New translations en.json (Russian) * New translations en.json (Spanish) * New translations en.json (Thai) * New translations en.json (Vietnamese) * New translations en.json (Acholi) * New translations en.json (Chinese Simplified) * New translations en.json (Chinese Traditional) * New translations en.json (Spanish) * New translations en.json (Polish) * New translations en.json (Indonesian) * New translations en.json (Russian) * New translations en.json (Vietnamese) * Added meta referrer tag * New Crowdin translations (#1341) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Chinese Simplified) * New translations en.json (Chinese Traditional) * New translations en.json (French) * New translations en.json (Indonesian) * New translations en.json (Italian) * New translations en.json (Polish) * New translations en.json (Portuguese) * New translations en.json (Russian) * New translations en.json (Spanish) * New translations en.json (Thai) * New translations en.json (Vietnamese) * New translations en.json (Acholi) * New translations en.json (Chinese Simplified) * New translations en.json (Chinese Traditional) * New translations en.json (Spanish) * New translations en.json (Polish) * New translations en.json (Indonesian) * New translations en.json (Russian) * New translations en.json (Vietnamese) * New translations en.json (Italian) * New translations en.json (French) * New translations en.json (Portuguese) * New translations en.json (Thai) * New translations en.json (Vietnamese) * New translations en.json (Vietnamese) * New translations en.json (Vietnamese) Co-authored-by: Morteza Tavanarad <morteza@binary.com> Co-authored-by: Nazanin Reihani <6875585+nazaninreihani@users.noreply.github.com> Co-authored-by: Ashkan <ashkan.nemati@gmail.com> * add circleci pipeline * change yarn to npm * change node tag * add release_beta workflows * change release tag match * change release tag match * change release tag match * change yarn to npm * change npm to yarn * change npm to yarn * change build command * change build image * change build image * test build * test build * change build image * build test * change image * build test * build test * build test * change image * change image to 11.15.0 * add production release workflow * fix production release workflow & add context * fix yaml * fix tag * fix node version * workflow test * add circleci pipeline * change context * Add Release pattern to README * add release format and workflow * fix docker build tag * fix k8s workflow * change upload artifact tag * test circleci workflow * fix circleci workflow * multiple clusters * add context to staging * rename step docker_build_push * circleci master/dev release * release does't always TAG * edit README * change gulp build Co-authored-by: Morteza Tavanarad <morteza@binary.com> Co-authored-by: Nazanin Reihani <6875585+nazaninreihani@users.noreply.github.com> Co-authored-by: Ashkan <ashkan.nemati@gmail.com>
1 parent 63d038b commit eb096d2

4 files changed

Lines changed: 185 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
version: 2.1
2+
orbs:
3+
k8s: circleci/kubernetes@0.7.0
4+
s3: circleci/aws-s3@1.0.13
5+
commands:
6+
git_checkout_from_cache:
7+
description: "Git checkout and save cache"
8+
steps:
9+
- restore_cache:
10+
name: Git restore cache
11+
keys:
12+
- source-v1-{{ .Branch }}-{{ .Revision }}
13+
- source-v1-{{ .Branch }}-
14+
- source-v1-
15+
- run:
16+
name: Fetch git tags
17+
command: |
18+
mkdir -p ~/.ssh
19+
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts
20+
# Fetch tags if git cache is present
21+
if [ -e /home/circleci/project/.git ]
22+
then
23+
git fetch origin --tags
24+
fi
25+
- checkout
26+
- run:
27+
name: Compress git objects
28+
command: git gc
29+
- save_cache:
30+
name: Git save cache
31+
key: source-v1-{{ .Branch }}-{{ .Revision }}
32+
paths:
33+
- ".git"
34+
npm_install:
35+
description: "Install npm modules"
36+
steps:
37+
- restore_cache:
38+
name: Restore npm cache
39+
keys:
40+
- npm-v1-{{ checksum "package.json" }}
41+
- npm-v1-
42+
- run:
43+
name: Install npm modules
44+
command: npm install && ./node_modules/.bin/bower install
45+
- save_cache:
46+
name: Save NPM cache
47+
key: npm-v1-{{ checksum "package.json" }}
48+
paths:
49+
- "node_modules"
50+
build:
51+
description: "Build"
52+
steps:
53+
- run:
54+
name: "gulp build"
55+
command: npx gulp build
56+
compress:
57+
description: "Compress"
58+
steps:
59+
- run:
60+
name: "Compress"
61+
command: |
62+
pushd www/
63+
tar -cvf artifact.tar *
64+
mv artifact.tar ${OLDPWD}/
65+
- run:
66+
name: "Tag commit id as artifact identifer"
67+
command: echo "${CIRCLE_SHA1}" > artifact-info.txt
68+
upload_artifact:
69+
description: "upload artifact to s3"
70+
steps:
71+
- s3/copy:
72+
from: artifact.tar
73+
to: 's3://${CONTEXT_ARTIFACT_S3_BUCKET}/${CIRCLE_PROJECT_REPONAME}/'
74+
aws-access-key-id: env_CONTEXT_ARTIFACT_S3_AWS_ACCESS_KEY_ID
75+
aws-secret-access-key: env_CONTEXT_ARTIFACT_S3_AWS_SECRET_ACCESS_KEY
76+
aws-region: env_CONTEXT_ARTIFACT_S3_AWS_REGION
77+
arguments: '--metadata "{\"x-amz-artifact-id\": \"${CIRCLE_SHA1}\" }"'
78+
upload_checksum:
79+
description: "upload artifact commit id to s3"
80+
steps:
81+
- s3/copy:
82+
from: artifact-info.txt
83+
to: 's3://${CONTEXT_ARTIFACT_S3_BUCKET}/${CIRCLE_PROJECT_REPONAME}/'
84+
aws-access-key-id: env_CONTEXT_ARTIFACT_S3_AWS_ACCESS_KEY_ID
85+
aws-secret-access-key: env_CONTEXT_ARTIFACT_S3_AWS_SECRET_ACCESS_KEY
86+
aws-region: env_CONTEXT_ARTIFACT_S3_AWS_REGION
87+
docker_build_push:
88+
description: "Build and Push image to docker hub"
89+
steps:
90+
- setup_remote_docker
91+
- run:
92+
name: Building docker image for production
93+
command: |
94+
docker build -t ${DOCKHUB_ORGANISATION}/ticktrade-mobile:${CIRCLE_SHA1} -t ${DOCKHUB_ORGANISATION}/ticktrade-mobile:latest .
95+
- run:
96+
name: Pushing Image to docker hub
97+
command: |
98+
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
99+
docker push ${DOCKHUB_ORGANISATION}/ticktrade-mobile
100+
k8s_deploy:
101+
description: "Deploy to k8s cluster"
102+
steps:
103+
- k8s/install-kubectl
104+
- run:
105+
name: Deploying to k8s cluster for service ticktrade-binary-com
106+
command: |
107+
for SERVER_ID in {1..5}
108+
do
109+
KUBE_SERVER_REF="KUBE_SERVER_$SERVER_ID"
110+
SERVICEACCOUNT_TOKEN_REF="SERVICEACCOUNT_TOKEN_$SERVER_ID"
111+
CA_CRT_REF="CA_CRT_$SERVER_ID"
112+
if [ ! -z "${!KUBE_SERVER_REF}" ]
113+
then
114+
echo "Deploying to cluster $SERVER_ID"
115+
CA_CRT="${!CA_CRT_REF}"
116+
KUBE_SERVER="${!KUBE_SERVER_REF}"
117+
SERVICEACCOUNT_TOKEN="${!SERVICEACCOUNT_TOKEN_REF}"
118+
echo $CA_CRT | base64 --decode > ca.crt
119+
kubectl --server=${KUBE_SERVER} --certificate-authority=ca.crt --token=$SERVICEACCOUNT_TOKEN set image deployment/ticktrade-binary-com ticktrade-binary-com=${DOCKHUB_ORGANISATION}/ticktrade-mobile:${CIRCLE_SHA1}
120+
fi
121+
done
122+
123+
124+
jobs:
125+
test:
126+
docker:
127+
- image: circleci/node:11.15.0
128+
steps:
129+
- git_checkout_from_cache
130+
- npm_install
131+
- build
132+
release_production:
133+
docker:
134+
- image: circleci/node:11.15.0
135+
steps:
136+
- git_checkout_from_cache
137+
- npm_install
138+
- build
139+
- compress
140+
- upload_artifact # uploading the built code to s3 to create a backup of key services separate from Kubernetes deployment
141+
- upload_checksum # uploading compressed artifact checksum to cross match artifact fingerprint before actual deployment
142+
- docker_build_push
143+
- k8s_deploy
144+
145+
workflows:
146+
test:
147+
jobs:
148+
- test:
149+
filters:
150+
branches:
151+
ignore: /^master$/
152+
release:
153+
jobs:
154+
- release_production:
155+
filters:
156+
branches:
157+
only: /^master$/
158+
context: binary-frontend-artifact-upload

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
Dockerfile

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM nginx:alpine
2+
COPY ./www /usr/share/nginx/html
3+
COPY ./default.conf /etc/nginx/conf.d/default.conf

default.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
add_header Cache-Control "public, max-age=7200, s-maxage=600, must-revalidate";
6+
charset UTF-8;
7+
8+
error_page 404 /404.html;
9+
10+
location @custom_error_503 {
11+
return 503;
12+
}
13+
14+
location ~ /\.git {
15+
return 404;
16+
}
17+
18+
location / {
19+
root /usr/share/nginx/html;
20+
index index.html index.htm;
21+
}
22+
}

0 commit comments

Comments
 (0)