Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Miroslav Kratochvil
r3-pages
Commits
9e333894
Commit
9e333894
authored
Jan 15, 2020
by
Jacek Lebioda
Browse files
feat(ci): weekly backup
Closes
#12
See merge request core-services/r3lab/r3-pages!11
parents
59a13abd
742bbe44
Changes
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
9e333894
# In case something goes horribly wrong, you can fall back to `image: ruby:latest`
image
:
git-r3lab.uni.lu:4567/r3/docker/jekyll-lcsb:1.0
stages
:
-
build
-
deploy
-
backup
build the website
:
stage
:
build
before_script
:
...
...
@@ -34,3 +39,20 @@ Deploy to production:
-
ssh -p $SSHPORT $SSHCONNECT "mkdir -p ~/web/r3lab_$CI_JOB_ID"
-
scp -P $SSHPORT -r build/* $SSHCONNECT:~/web/r3lab_$CI_JOB_ID
-
ssh -p $SSHPORT $SSHCONNECT "cd ~/web/latest && ln -fs ../r3lab_$CI_JOB_ID/* . && cd .. && find . -type d -name 'r3lab*' -not -newermt '-1 minutes' -exec rm -rf {} +"
## Backups
Create the backup
:
stage
:
backup
image
:
alpine:3.1
when
:
manual
before_script
:
-
'
which
ssh-agent
||
(
apk
add
--update
openssh
)'
-
eval $(ssh-agent -s)
-
echo "$SSHPRIVKEY" | tr -d '\r' | ssh-add - > /dev/null
-
mkdir -p ~/.ssh && chmod 700 ~/.ssh
-
'
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
echo "$KNOWNHOSTS" > ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
script
:
-
ssh -p $SSHPORT $SSHCONNECT "mkdir -p ~/web/latest ~/backups/; cd ~/web/; tar -zchvf ~/backups/backup_$(date +'%Y_%m_%d').tar.gz latest"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment