Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Leaderboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Bouquet
Leaderboard
Commits
fe454d6b
Commit
fe454d6b
authored
4 years ago
by
Thomas Bouquet
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://gitlab.viarezo.fr/coshyperbolix/leaderboard
parents
dc701931
67501665
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+119
-0
119 additions, 0 deletions
.gitlab-ci.yml
with
119 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
119
−
0
View file @
fe454d6b
image
:
node:15
stages
:
-
build
-
deploy
################################################################################
##### BUILD STAGE #####
################################################################################
build-front
:
stage
:
build
only
:
-
master
-
staging
script
:
-
cd ./front
-
npm install --only=prod
-
CI=false npm run build
artifacts
:
paths
:
-
front/node_modules/
-
front/build/
################################################################################
##### PREPROD-DEPLOY STAGE #####
################################################################################
back-preprod-deploy
:
stage
:
deploy
only
:
-
staging
script
:
-
"
which
ssh-agent
||
(
apt-get
update
-y
&&
apt-get
install
openssh-client
-y
)"
-
eval $(ssh-agent -s)
-
ssh-add <(echo "$SSH_PRIVATE_KEY")
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
echo ${PREPROD_SECRETS} > secrets.js
-
scp secrets.js root@humaviron.cs-campus.fr:~/leaderboard/back/src/secrets.js
-
>
ssh root@humaviron.cs-campus.fr
"cd leaderboard/back &&
git stash &&
git checkout staging &&
git stash &&
git pull &&
npm install --only=prod &&
pm2 delete back-preprod &&
pm2 start src/index.js --name back-preprod &&
exit"
front-preprod-deploy
:
stage
:
deploy
only
:
-
staging
dependencies
:
-
build-front
script
:
-
"
which
ssh-agent
||
(
apt-get
update
-y
&&
apt-get
install
openssh-client
-y
)"
-
eval $(ssh-agent -s)
-
ssh-add <(echo "$SSH_PRIVATE_KEY")
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
>
ssh root@humaviron.cs-campus.fr
"sudo rm -rf /var/www/preprod/* &&
exit"
-
"
scp
-r
./front/build/*
root@humaviron.cs-campus.fr:/var/www/preprod"
################################################################################
##### PROD-DEPLOY STAGE #####
################################################################################
back-prod-deploy
:
stage
:
deploy
only
:
-
master
script
:
-
"
which
ssh-agent
||
(
apt-get
update
-y
&&
apt-get
install
openssh-client
-y
)"
-
eval $(ssh-agent -s)
-
ssh-add <(echo "$SSH_PRIVATE_KEY")
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
echo ${PROD_SECRETS} > secrets.js
-
scp secrets.js root@humaviron.cs-campus.fr:~/leaderboard/back/src/secrets.js
-
>
ssh root@humaviron.cs-campus.fr
"cd leaderboard/back &&
git stash &&
git checkout master &&
git stash &&
git pull &&
npm install --only=prod &&
pm2 delete back-prod &&
PROD=true pm2 start src/index.js --name back-prod &&
exit"
front-prod-deploy
:
stage
:
deploy
only
:
-
master
dependencies
:
-
build-front
script
:
-
"
which
ssh-agent
||
(
apt-get
update
-y
&&
apt-get
install
openssh-client
-y
)"
-
eval $(ssh-agent -s)
-
ssh-add <(echo "$SSH_PRIVATE_KEY")
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
>
ssh root@humaviron.cs-campus.fr
"sudo rm -rf /var/www/prod/* &&
exit"
-
"
scp
-r
./front/build/*
root@humaviron.cs-campus.fr:/var/www/prod"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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