Skip to content

Commit

Permalink
feat: 移除 redis
Browse files Browse the repository at this point in the history
  • Loading branch information
icyleaf committed Apr 8, 2024
1 parent c2bfed7 commit e951dac
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 20 deletions.
9 changes: 1 addition & 8 deletions backup
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ backup_db () {
docker cp zealot-postgresql:/tmp/db.dump $BACKUP_DIR
}

backup_redis () {
echo ""
echo "== Backup redis =="
docker cp zealot-redis:/data/dump.rdb $BACKUP_DIR/redis.rdb
}

backup_zealot () {
echo ""
echo "== Backup zealot data =="
Expand All @@ -43,12 +37,11 @@ compress () {
cleanup () {
echo
echo "== Cleaning up =="
rm -rf $BACKUP_DIR/uploads $BACKUP_DIR/db.dump $BACKUP_DIR/redis.rdb
rm -rf $BACKUP_DIR/uploads $BACKUP_DIR/db.dump
}
trap cleanup ERR INT TERM HUP QUIT

backup_db
backup_redis
backup_zealot
compress
cleanup
3 changes: 0 additions & 3 deletions config.env
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,3 @@ ZEALOT_POSTGRES_PORT=5432
ZEALOT_POSTGRES_USERNAME=postgres
ZEALOT_POSTGRES_PASSWORD=ze@l0t
ZEALOT_POSTGRES_DB_NAME=zealot

# The full Redis URL for the Redis cache.
REDIS_URL=redis://redis:6379/0
2 changes: 1 addition & 1 deletion scripts/check-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function ver () { echo "$@" | awk -F. '{ printf("%d%03d%03d", $1,$2,$3); }'; }
## Check docker compose version (v1 and v2)
##
function get_docker_compose_version () {
COMPOSE_VERSION=$(docker-compose version | head -n1 | sed -E 's/^.* version:? v?([0-9.]+),?.*$/\1/')
COMPOSE_VERSION=$(dc_base version | head -n1 | sed -E 's/^.* version:? v?([0-9.]+),?.*$/\1/')
}

##
Expand Down
5 changes: 1 addition & 4 deletions scripts/configure-volumes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ create_docker_volumes () {
echo "Created $(docker volume create --name=zealot-uploads)."
echo "Created $(docker volume create --name=zealot-backup)."
echo "Created $(docker volume create --name=zealot-postgres)."
echo "Created $(docker volume create --name=zealot-redis)."

cat $TEMPLATE_DOCKER_COMPOSE_PATH/external-volumes.yml >> $DOCKER_COMPOSE_FILE
echo "Exteral volumes write to file: $DOCKER_COMPOSE_FILE"
Expand All @@ -30,12 +29,10 @@ configure_local_docker_volumes() {
else
mkdir -p "$stored/zealot/uploads"
mkdir -p "$stored/zealot/backup"
mkdir -p "$stored/redis"
mkdir -p "$stored/postgres"

sed -i -e 's|zealot-uploads|'"$stored"'/uploads|g' $DOCKER_COMPOSE_FILE
sed -i -e 's|zealot-backup|'"$stored"'/backup|g' $DOCKER_COMPOSE_FILE
sed -i -e 's|zealot-redis|'"$stored"'/redis|g' $DOCKER_COMPOSE_FILE
sed -i -e 's|zealot-postgres|'"$stored"'/postgres|g' $DOCKER_COMPOSE_FILE
clean_sed_temp_file $DOCKER_COMPOSE_FILE

Expand Down Expand Up @@ -67,7 +64,7 @@ choose_volumes () {


VOLUMES_EXISTS=$(grep -qcE "^(\s+)zealot\-(\w+):" $DOCKER_COMPOSE_FILE || echo 0)
if [ "$VOLUMES_EXISTS" -eq 4 ]; then
if [ "$VOLUMES_EXISTS" -eq 3 ]; then
echo "Volumes already exists, skipped"
else
choose_volumes
Expand Down
5 changes: 1 addition & 4 deletions scripts/wrap-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ if [[ "$MINIMIZE_DOWNTIME" ]]; then
$dc up -d --remove-orphans $($dc config --services | grep -v -E '^(web)$')
$dc exec -T web caddy reload --config /etc/caddy/Caddyfile

docker run --rm --network="${COMPOSE_PROJECT_NAME}_default" redis:5-alpine ash \
-c 'while [[ "$(wget -T 1 -q -O- http://web:3000/_health/)" != "ok" ]]; do sleep 0.5; done'

# Make sure everything is up. This should only touch relay and nginx
$dc up -d

Expand All @@ -18,7 +15,7 @@ else
echo ""
echo "You're all done! Run the following command to get Zealot running:"
echo ""
echo " [sudo] docker-compose up -d"
echo " [sudo] docker compose up -d"
echo ""
echo "-----------------------------------------------------------------"
echo ""
Expand Down

0 comments on commit e951dac

Please sign in to comment.