-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into checkit-deploy
# Conflicts: # components.yml # docker-compose.yml
- Loading branch information
Showing
7 changed files
with
114 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Otevřená data ČR @ DIA | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
# Helper script to backup docker volumes. It allows to set up automatic cleanup of backups (picks up backups to remove randomly). | ||
|
||
##################### | ||
### CONFIGURATION ### | ||
##################### | ||
|
||
# directory where backups are created | ||
BACKUPS_ROOT_DIR=/backup/docker-volumes | ||
|
||
# automatic cleanup is triggered only if at least MIN_BACKUPS_COUNT backups are available | ||
MIN_BACKUPS_COUNT=10 | ||
|
||
# automatic cleanup is triggered only if more than MAXIMAL_BACKUP_STORAGE_SIZE_IN_GB space is taken | ||
MAXIMAL_BACKUP_STORAGE_SIZE_IN_GB=35 | ||
|
||
########################## | ||
### REMOVE OLD BACKUPS ### | ||
########################## | ||
|
||
BACKUP_STORAGE_SIZE="`du -BG -s $BACKUPS_ROOT_DIR | sed 's/G.*//' 2>/dev/null`" | ||
BACKUPS_COUNT="`ls $BACKUPS_ROOT_DIR/*.tar.gz | wc -l 2>/dev/null`" | ||
|
||
if [ "$BACKUPS_COUNT" -gt "$MIN_BACKUPS_COUNT" ]; then | ||
if [ "$BACKUP_STORAGE_SIZE" -gt "$MAXIMAL_BACKUP_STORAGE_SIZE_IN_GB" ]; then | ||
|
||
# pick random 2 files beside MIN_BACKUPS_COUNT newest | ||
FILES_TO_REMOVE="`ls -t $BACKUPS_ROOT_DIR/[0-9]*.tar.gz | tail +$( expr $MIN_BACKUPS_COUNT + 1 ) | shuf -n 2`" | ||
echo INFO: Removing files $FILES_TO_REMOVE | ||
rm $FILES_TO_REMOVE | ||
fi | ||
fi | ||
|
||
########################## | ||
### CREATE NEW BACKUPS ### | ||
########################## | ||
|
||
FILE=$(date +'%Y%m%d').tar.gz | ||
tar -zcvf $FILE /var/lib/docker/volumes | ||
mv $FILE $BACKUPS_ROOT_DIR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Helper script to send messages to slack channel. | ||
|
||
################# | ||
# CONFIGURATION # | ||
################# | ||
|
||
# webhook to slack channel typically starting with https://hooks.slack.com/services/ | ||
WEBHOOK= | ||
|
||
# context of assembly line e.g. PROD/TEST/DEV | ||
CTX=PROD | ||
|
||
######## | ||
# MAIN # | ||
######## | ||
|
||
MESSAGE=$1 | ||
ICON=$2 | ||
|
||
curl -X POST --data-urlencode "payload={\"channel\": \"#monitorování-výrobní-linky\", \"username\": \"[$CTX] Nasazení výrobní linky\", \"text\": \"$MESSAGE\", \"icon_emoji\": \"$ICON\"}" $WEBHOOK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters