Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Commits
2389a7b6
Commit
2389a7b6
authored
6 years ago
by
Bogdan Cochior
Browse files
Options
Downloads
Patches
Plain Diff
ci(aws): add env variables in deployment script from gitlab
parent
d9b7c8c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!10
Sprint #12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.old.yml
+0
-0
0 additions, 0 deletions
.gitlab-ci.old.yml
.gitlab-ci.yml
+15
-14
15 additions, 14 deletions
.gitlab-ci.yml
with
15 additions
and
14 deletions
.gitlab-ci.
v1
.yml
→
.gitlab-ci.
old
.yml
+
0
−
0
View file @
2389a7b6
File moved
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
15
−
14
View file @
2389a7b6
...
...
@@ -13,7 +13,7 @@ build:
-
export AWS_REGION="eu-west-1"
-
export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
-
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
-
export REPO=$
REPOSITORY
_URL
-
export REPO=$
CI_ECR
_URL
-
apk update
-
apk --no-cache add --update curl python python-dev py-pip
-
pip install awscli --upgrade --user
...
...
@@ -29,7 +29,7 @@ build:
name
:
qa
lint
:
image
:
$
REPOSITORY
_URL:latest
image
:
$
CI_ECR
_URL:latest
stage
:
test
variables
:
GIT_STRATEGY
:
none
...
...
@@ -38,7 +38,7 @@ lint:
-
npm run lint
test
:
image
:
$
REPOSITORY
_URL:latest
image
:
$
CI_ECR
_URL:latest
stage
:
test
variables
:
GIT_STRATEGY
:
none
...
...
@@ -46,7 +46,7 @@ test:
-
cd ${HOME}
-
npm run test
deploy:
aws
:
aws
-qa
:
stage
:
deploy
script
:
-
export AWS_REGION="eu-west-1"
...
...
@@ -55,24 +55,25 @@ deploy:aws:
-
apk --no-cache add --update python python-dev py-pip
-
pip install ecs-deploy
# Deploy
-
ecs deploy ${CI_CLUSTER_NAME} ${CI_SERVICE_NAME} --region ${AWS_REGION} --timeout
600
-
ecs deploy ${CI_CLUSTER_NAME} ${CI_SERVICE_NAME} --region ${AWS_REGION} --timeout 600
-e ${CI_CONTAINER_NAME} AWS_S3_ACCESS_KEY $AWS_S3_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_S3_SECRET_KEY $AWS_S3_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_S3_REGION $AWS_S3_REGION -e ${CI_CONTAINER_NAME} AWS_S3_BUCKET $AWS_S3_BUCKET -e ${CI_CONTAINER_NAME} AWS_SES_SECRET_KEY $AWS_SES_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_SES_ACCESS_KEY $AWS_SES_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_SES_REGION $AWS_SES_REGION -e ${CI_CONTAINER_NAME} EMAIL_SENDER $EMAIL_SENDER -e ${CI_CONTAINER_NAME} secret $SECRET -e ${CI_CONTAINER_NAME} DATABASE $DATABASE -e ${CI_CONTAINER_NAME} DB_USER $DB_USER -e ${CI_CONTAINER_NAME} DB_PASS $DB_PASS -e ${CI_CONTAINER_NAME} DB_HOST $DB_HOST
environment
:
name
:
qa
deploy:
now
:
image
:
$
REPOSITORY
_URL:latest
now
.sh
:
image
:
$
CI_ECR
_URL:latest
stage
:
deploy
when
:
manual
variables
:
PACKAGE_NAME
:
xpub-faraday
script
:
-
npm i -g --unsafe-perm now
-
cd ${HOME}/now
-
echo "FROM ${
REPOSITORY
_URL}:latest" >> Dockerfile
-
echo "FROM ${
CI_ECR
_URL}:latest" >> Dockerfile
-
now --public --docker --token $NOW_TOKEN -e AWS_S3_ACCESS_KEY=$AWS_S3_ACCESS_KEY -e AWS_S3_SECRET_KEY=$AWS_S3_SECRET_KEY -e AWS_S3_REGION=$AWS_S3_REGION -e AWS_S3_BUCKET=$AWS_S3_BUCKET -e AWS_SES_SECRET_KEY=$AWS_SES_SECRET_KEY -e AWS_SES_ACCESS_KEY=$AWS_SES_ACCESS_KEY -e AWS_SES_REGION=$AWS_SES_REGION -e EMAIL_SENDER=$EMAIL_SENDER -e secret=$SECRET -e DATABASE=$DATABASE -e DB_USER=$DB_USER -e DB_PASS=$DB_PASS -e DB_HOST=$DB_HOST
-
now alias $NOW_URL xpub-faraday-qa --token $NOW_TOKEN
environment
:
name
:
qa
url
:
https://xpub-faraday-qa.now.sh/
deploy:
create-rollback
:
create-rollback
:
stage
:
deploy
script
:
-
export AWS_REGION="eu-west-1"
...
...
@@ -91,7 +92,7 @@ deploy:create-rollback:
-
echo successful revision is ${REV} Storing it in S3 Bucket
-
echo ${REV} > /${CI_SERVICE_NAME}
# sync rev to S3 here
-
aws s3 cp /${CI_SERVICE_NAME} s3://${REV_BUCKET}
-
aws s3 cp /${CI_SERVICE_NAME} s3://${
CI_
REV_BUCKET}
environment
:
name
:
qa
...
...
@@ -105,10 +106,10 @@ rollback:
-
pip install awscli --upgrade --user
-
export PATH=~/.local/bin:/usr/bin/:$PATH
-
pip install ecs-deploy
-
aws s3 cp s3://${REV_BUCKET}/${CI_SERVICE_NAME} ./
-
aws s3 cp s3://${
CI_
REV_BUCKET}/${CI_SERVICE_NAME} ./
-
REV=`cat ./${CI_SERVICE_NAME}`
-
echo rev is $REV
-
ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${CI_SERVICE_NAME} --task ${REV}
-
ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${CI_SERVICE_NAME} --task ${REV}
-e ${CI_CONTAINER_NAME} AWS_S3_ACCESS_KEY $AWS_S3_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_S3_SECRET_KEY $AWS_S3_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_S3_REGION $AWS_S3_REGION -e ${CI_CONTAINER_NAME} AWS_S3_BUCKET $AWS_S3_BUCKET -e ${CI_CONTAINER_NAME} AWS_SES_SECRET_KEY $AWS_SES_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_SES_ACCESS_KEY $AWS_SES_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_SES_REGION $AWS_SES_REGION -e ${CI_CONTAINER_NAME} EMAIL_SENDER $EMAIL_SENDER -e ${CI_CONTAINER_NAME} secret $SECRET -e ${CI_CONTAINER_NAME} DATABASE $DATABASE -e ${CI_CONTAINER_NAME} DB_USER $DB_USER -e ${CI_CONTAINER_NAME} DB_PASS $DB_PASS -e ${CI_CONTAINER_NAME} DB_HOST $DB_HOST
environment
:
name
:
qa
when
:
on_failure
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment