Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker-compose.yml
.DS_Store
.DS_Store
.idea
18 changes: 18 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
stages:
- Build
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA

build-image:
stage: Build
only:
- develop
- main
image: docker:20.10.16
services:
- docker:20.10.16-dind

script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull -t $IMAGE_TAG .
- docker push $IMAGE_TAG
15 changes: 13 additions & 2 deletions resources/perform-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@ do
then

echo -e "Database backup successfully completed for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')."
backup_name=$CURRENT_DATABASE_$(date +"%Y-%m-%d_%H-%M-%S").sql

FILENAME=$CURRENT_DATABASE_$(date +"%Y-%m-%d_%H-%M-%S")

if [ "$USE_COMPRESSION" = true ]
then
tar -czvf /tmp/$CURRENT_DATABASE.tar.gz /tmp/$CURRENT_DATABASE.sql
FILENAME=$FILENAME.tar.gz
awsoutput=$(aws s3 cp /tmp/$CURRENT_DATABASE.tar.gz s3://$AWS_BUCKET_BACKUP_PATH/$FILENAME --endpoint-url $AWS_BUCKET_URI 2>&1)
else
FILENAME=$FILENAME.sql
awsoutput=$(aws s3 cp /tmp/$CURRENT_DATABASE.sql s3://$AWS_BUCKET_BACKUP_PATH/$FILENAME --endpoint-url $AWS_BUCKET_URI 2>&1)
fi
# Perform the upload to S3. Put the output to a variable. If successful, print an entry to the console and the log. If unsuccessful, set has_failed to true and print an entry to the console and the log
if awsoutput=$(aws s3 cp /tmp/$CURRENT_DATABASE.sql $AWS_BUCKET_URI$AWS_BUCKET_BACKUP_PATH/$backup_name 2>&1)
if [ "$awsoutput" = true ]
then
echo -e "Database backup successfully uploaded for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')."
else
Expand Down