Skip to content

Commit c745d1f

Browse files
committed
feat(misc): adjust db helper functions
1 parent 8656e82 commit c745d1f

File tree

6 files changed

+27
-127
lines changed

6 files changed

+27
-127
lines changed

backup-database.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

downloads3.sh

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
#!/bin/bash
22

3-
# System variables
4-
BUCKET=s3://finanssoreal/database/
5-
6-
OBJECT="$(aws s3 ls $BUCKET | sort | tail -n 1 | awk '{print $4}')"
7-
FULL_PATH="$HOME/$OBJECT"
8-
9-
aws s3 cp "$BUCKET$OBJECT" "$FULL_PATH"
10-
gunzip $FULL_PATH
11-
12-
# UPDATE full path
13-
FULL_PATH="${FULL_PATH%.gz}"
14-
15-
if [[ "$1" == "-fixsql" ]]; then
16-
sed -i 's/DEFINER=`forge`@`%`/DEFINER=`finanssoreal`@`%`/g' $FULL_PATH
17-
fi
18-
19-
if [[ "$2" == "-fixutf8" ]]; then
20-
sed -i 's/utf8mb4_0900_ai_ci/utf8_general_ci/g' $FULL_PATH
21-
fi
22-
23-
echo "Dump descargado correctamente en $FULL_PATH"
3+
DOCKER_IMAGE="finanssoreal/db-helper:latest"
4+
MARIA_DATA="$HOME/maria-data"
5+
AWS_HOME="$HOME/.aws"
6+
7+
# create the base directories
8+
mkdir -p "$MARIA_DATA" && mkdir -p "$AWS_HOME"
9+
10+
# insert dump into database
11+
podman run --rm -it \
12+
-v $MARIA_DATA:/etc/maria-data \
13+
-v $AWS_HOME:/root/.aws \
14+
--network=host $DOCKER_IMAGE download

dump2container.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

dump2db.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
DOCKER_IMAGE="finanssoreal/db-helper:latest"
4+
MARIA_DATA="$HOME/maria-data"
5+
AWS_HOME="$HOME/.aws"
6+
7+
# create the base directories
8+
mkdir -p "$MARIA_DATA" && mkdir -p "$AWS_HOME"
9+
10+
# download a dump from the database
11+
podman run --rm -it \
12+
-v $MARIA_DATA:/etc/maria-data \
13+
-v $AWS_HOME:/root/.aws \
14+
--network=host $DOCKER_IMAGE insert

dump2pod.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

ip-tables-fix.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
iptables -P INPUT ACCEPT
34
iptables -P FORWARD ACCEPT
45
iptables -P OUTPUT ACCEPT

0 commit comments

Comments
 (0)