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

Commit

Permalink
Afshin/add circleci pipeline (#1346)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

Co-authored-by: Nazanin Reihani <[email protected]>
Co-authored-by: Ashkan <[email protected]>

* 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 <[email protected]>
Co-authored-by: Nazanin Reihani <[email protected]>
Co-authored-by: Ashkan <[email protected]>
  • Loading branch information
4 people authored Apr 1, 2020
1 parent 63d038b commit eb096d2
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
158 changes: 158 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
version: 2.1
orbs:
k8s: circleci/[email protected]
s3: circleci/[email protected]
commands:
git_checkout_from_cache:
description: "Git checkout and save cache"
steps:
- restore_cache:
name: Git restore cache
keys:
- source-v1-{{ .Branch }}-{{ .Revision }}
- source-v1-{{ .Branch }}-
- source-v1-
- run:
name: Fetch git tags
command: |
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts
# Fetch tags if git cache is present
if [ -e /home/circleci/project/.git ]
then
git fetch origin --tags
fi
- checkout
- run:
name: Compress git objects
command: git gc
- save_cache:
name: Git save cache
key: source-v1-{{ .Branch }}-{{ .Revision }}
paths:
- ".git"
npm_install:
description: "Install npm modules"
steps:
- restore_cache:
name: Restore npm cache
keys:
- npm-v1-{{ checksum "package.json" }}
- npm-v1-
- run:
name: Install npm modules
command: npm install && ./node_modules/.bin/bower install
- save_cache:
name: Save NPM cache
key: npm-v1-{{ checksum "package.json" }}
paths:
- "node_modules"
build:
description: "Build"
steps:
- run:
name: "gulp build"
command: npx gulp build
compress:
description: "Compress"
steps:
- run:
name: "Compress"
command: |
pushd www/
tar -cvf artifact.tar *
mv artifact.tar ${OLDPWD}/
- run:
name: "Tag commit id as artifact identifer"
command: echo "${CIRCLE_SHA1}" > artifact-info.txt
upload_artifact:
description: "upload artifact to s3"
steps:
- s3/copy:
from: artifact.tar
to: 's3://${CONTEXT_ARTIFACT_S3_BUCKET}/${CIRCLE_PROJECT_REPONAME}/'
aws-access-key-id: env_CONTEXT_ARTIFACT_S3_AWS_ACCESS_KEY_ID
aws-secret-access-key: env_CONTEXT_ARTIFACT_S3_AWS_SECRET_ACCESS_KEY
aws-region: env_CONTEXT_ARTIFACT_S3_AWS_REGION
arguments: '--metadata "{\"x-amz-artifact-id\": \"${CIRCLE_SHA1}\" }"'
upload_checksum:
description: "upload artifact commit id to s3"
steps:
- s3/copy:
from: artifact-info.txt
to: 's3://${CONTEXT_ARTIFACT_S3_BUCKET}/${CIRCLE_PROJECT_REPONAME}/'
aws-access-key-id: env_CONTEXT_ARTIFACT_S3_AWS_ACCESS_KEY_ID
aws-secret-access-key: env_CONTEXT_ARTIFACT_S3_AWS_SECRET_ACCESS_KEY
aws-region: env_CONTEXT_ARTIFACT_S3_AWS_REGION
docker_build_push:
description: "Build and Push image to docker hub"
steps:
- setup_remote_docker
- run:
name: Building docker image for production
command: |
docker build -t ${DOCKHUB_ORGANISATION}/ticktrade-mobile:${CIRCLE_SHA1} -t ${DOCKHUB_ORGANISATION}/ticktrade-mobile:latest .
- run:
name: Pushing Image to docker hub
command: |
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
docker push ${DOCKHUB_ORGANISATION}/ticktrade-mobile
k8s_deploy:
description: "Deploy to k8s cluster"
steps:
- k8s/install-kubectl
- run:
name: Deploying to k8s cluster for service ticktrade-binary-com
command: |
for SERVER_ID in {1..5}
do
KUBE_SERVER_REF="KUBE_SERVER_$SERVER_ID"
SERVICEACCOUNT_TOKEN_REF="SERVICEACCOUNT_TOKEN_$SERVER_ID"
CA_CRT_REF="CA_CRT_$SERVER_ID"
if [ ! -z "${!KUBE_SERVER_REF}" ]
then
echo "Deploying to cluster $SERVER_ID"
CA_CRT="${!CA_CRT_REF}"
KUBE_SERVER="${!KUBE_SERVER_REF}"
SERVICEACCOUNT_TOKEN="${!SERVICEACCOUNT_TOKEN_REF}"
echo $CA_CRT | base64 --decode > ca.crt
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}
fi
done
jobs:
test:
docker:
- image: circleci/node:11.15.0
steps:
- git_checkout_from_cache
- npm_install
- build
release_production:
docker:
- image: circleci/node:11.15.0
steps:
- git_checkout_from_cache
- npm_install
- build
- compress
- upload_artifact # uploading the built code to s3 to create a backup of key services separate from Kubernetes deployment
- upload_checksum # uploading compressed artifact checksum to cross match artifact fingerprint before actual deployment
- docker_build_push
- k8s_deploy

workflows:
test:
jobs:
- test:
filters:
branches:
ignore: /^master$/
release:
jobs:
- release_production:
filters:
branches:
only: /^master$/
context: binary-frontend-artifact-upload
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
Dockerfile
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:alpine
COPY ./www /usr/share/nginx/html
COPY ./default.conf /etc/nginx/conf.d/default.conf
22 changes: 22 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;
server_name localhost;

add_header Cache-Control "public, max-age=7200, s-maxage=600, must-revalidate";
charset UTF-8;

error_page 404 /404.html;

location @custom_error_503 {
return 503;
}

location ~ /\.git {
return 404;
}

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}

0 comments on commit eb096d2

Please sign in to comment.