Skip to content

Commit ce60876

Browse files
authored
Merge pull request #102 from gitnnolabs/update_dependence
Atualiza dependências Dependabot (Python, Docker, Actions)
2 parents c6349bb + 5df38ba commit ce60876

6 files changed

Lines changed: 53 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
steps:
2525

2626
- name: Checkout Code Repository
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v6
2828

2929
- name: Set up Python
30-
uses: actions/setup-python@v4
30+
uses: actions/setup-python@v6
3131
with:
3232
python-version: "3.12"
3333
#cache: pip
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646

4747
- name: Checkout Code Repository
48-
uses: actions/checkout@v3
48+
uses: actions/checkout@v6
4949

5050
- name: Build the Stack
5151
run: docker compose -f local.yml build

compose/production/postgres/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM postgres:15.3
1+
FROM postgres:18.4
22

33
COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
44
RUN chmod +x /usr/local/bin/maintenance/*

compose/production/traefik/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM traefik:2.10.3
1+
FROM traefik:v3.7.1
22
RUN mkdir -p /etc/traefik/acme \
33
&& touch /etc/traefik/acme/acme.json \
44
&& chmod 600 /etc/traefik/acme/acme.json

requirements/base.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
setuptools>=68.2.2,<82
2-
whitenoise==6.6.0 # https://github.com/evansd/whitenoise
3-
redis==5.0.1 # https://github.com/redis/redis-py
2+
whitenoise==6.12.0 # https://github.com/evansd/whitenoise
3+
redis==7.4.0 # https://github.com/redis/redis-py
44
celery==5.3.6 # pyup: < 6.0 # https://github.com/celery/celery
55
flower==2.0.1 # https://github.com/mher/flower
66
hiredis==2.2.3 # https://github.com/redis/hiredis-py
@@ -27,7 +27,7 @@ lxml==4.9.4 # https://github.com/lxml/lxml
2727

2828
# Kombu
2929
# ------------------------------------------------------------------------------
30-
kombu==5.4.2
30+
kombu==5.6.2
3131

3232
# Tenacity
3333
# ------------------------------------------------------------------------------

requirements/production.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
-r base.txt
44

5-
gevent==24.2.1 # http://www.gevent.org/
5+
gevent==26.4.0 # http://www.gevent.org/
66
gunicorn==26.0.0
77
psycopg2-binary==2.9.9 # https://github.com/psycopg/psycopg2
88
sentry-sdk[django]==2.60.0
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
set -o nounset
6+
7+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
8+
COMPOSE_FILE="${COMPOSE_FILE:-${ROOT_DIR}/local.yml}"
9+
COMPOSE_SERVICE="${COMPOSE_SERVICE:-postgres}"
10+
ARCHIVE_ROOT="${ARCHIVE_ROOT:-${ROOT_DIR}/../scms_data/markapi/postgres_backups_pre_upgrade}"
11+
TIMESTAMP="$(date +'%Y_%m_%dT%H_%M_%S')"
12+
ARCHIVE_DIR="${ARCHIVE_ROOT}/${TIMESTAMP}"
13+
14+
cd "${ROOT_DIR}"
15+
16+
if ! docker compose -f "${COMPOSE_FILE}" ps --status running "${COMPOSE_SERVICE}" 2>/dev/null | grep -q "${COMPOSE_SERVICE}"; then
17+
echo "Serviço ${COMPOSE_SERVICE} não está em execução. Suba o stack: docker compose -f ${COMPOSE_FILE} up -d ${COMPOSE_SERVICE}"
18+
exit 1
19+
fi
20+
21+
echo "A criar backup lógico (pg_dump) no contentor ${COMPOSE_SERVICE}..."
22+
docker compose -f "${COMPOSE_FILE}" exec -T "${COMPOSE_SERVICE}" backup
23+
24+
mkdir -p "${ARCHIVE_DIR}"
25+
BACKUP_VOLUME="${BACKUP_VOLUME:-../scms_data/markapi/data_dev_backup}"
26+
27+
if [[ -d "${ROOT_DIR}/${BACKUP_VOLUME}" ]]; then
28+
shopt -s nullglob
29+
backups=("${ROOT_DIR}/${BACKUP_VOLUME}"/backup_*.sql.gz)
30+
shopt -u nullglob
31+
if [[ ${#backups[@]} -eq 0 ]]; then
32+
echo "Nenhum ficheiro backup_*.sql.gz em ${ROOT_DIR}/${BACKUP_VOLUME}"
33+
exit 1
34+
fi
35+
latest_backup="$(ls -t "${backups[@]}" | head -1)"
36+
cp -a "${latest_backup}" "${ARCHIVE_DIR}/"
37+
cp -a "${latest_backup}" "${ARCHIVE_ROOT}/latest_pre_upgrade.sql.gz"
38+
echo "Cópia de segurança: ${ARCHIVE_DIR}/$(basename "${latest_backup}")"
39+
echo "Atalho: ${ARCHIVE_ROOT}/latest_pre_upgrade.sql.gz"
40+
else
41+
echo "Volume de backups não encontrado (${ROOT_DIR}/${BACKUP_VOLUME}). O dump foi criado no contentor em /backups."
42+
fi
43+
44+
echo "Concluído. Antes de subir Postgres 18, pare django/celery e siga docs/ops/postgres-upgrade-backup.md"

0 commit comments

Comments
 (0)