fix(gitea): #35 Convert from docker to k3s
This commit is contained in:
parent
6ffb34a96b
commit
ce746ad72b
1 changed files with 6 additions and 4 deletions
|
@ -43,9 +43,11 @@ else
|
|||
destination="${1}"
|
||||
fi
|
||||
|
||||
namespace="ix-gitea-2"
|
||||
|
||||
# Retrieve container names
|
||||
base_container="$( docker ps --format '{{.Names}}' | grep -E 'gitea_gitea-[0-9a-z]{10}-[0-9a-z]{5}' )"
|
||||
database_container="$( docker ps --format '{{.Names}}' | grep 'postgres_gitea-cnpg-main-1' )"
|
||||
base_container="$( k3s kubectl get pods --namespace "${namespace}" | cut -f1 -d' ' | grep -E 'gitea-2-[0-9a-z]{10}-[0-9a-z]{5}' )"
|
||||
database_container="$( k3s kubectl get pods --namespace "${namespace}" | cut -f1 -d' ' | grep 'gitea-2-cnpg-main-2' )"
|
||||
|
||||
if ! [[ -n "${base_container}" && -n "${database_container}" ]]; then
|
||||
>&2 printf "Error: Not all containers could be found.\n"
|
||||
|
@ -57,7 +59,7 @@ set -e
|
|||
|
||||
# Enable maintenance mode
|
||||
# Flush queues
|
||||
docker exec "${base_container}" gitea manager flush-queues
|
||||
k3s kubectl exec "${base_container}" --namespace "${namespace}" -- gitea manager flush-queues
|
||||
# TODO Pause queues
|
||||
|
||||
# Database backup
|
||||
|
@ -68,7 +70,7 @@ host_database_backupfile="${destination}/${database_backupfile}"
|
|||
|
||||
# Backup the database
|
||||
>&2 echo 'Backing up database'
|
||||
docker exec --env-file "${env_file:=.env}" "${database_container}" pg_dump 'gitea' -cwv -h 'localhost' -U 'gitea' > "${host_database_backupfile}"
|
||||
k3s kubectl exec "${database_container}" --namespace "${namespace}" -- env $(cat "${env_file:=.env}" | xargs) pg_dump 'gitea' -cwv -h 'localhost' -U 'gitea' > "${host_database_backupfile}"
|
||||
|
||||
# Disable maintenance mode
|
||||
# TODO Continue queues
|
||||
|
|
Loading…
Reference in a new issue