Skip to content

Commit

Permalink
Merge pull request #110 from serlo/anonymous-bucket-change
Browse files Browse the repository at this point in the history
db: change to another bucket
  • Loading branch information
hugotiburtino authored Aug 2, 2024
2 parents 2e6ebed + 4c9ee46 commit 709b438
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions envs/production/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module "gcloud_postgres" {

module "athene2-dbdump" {
source = "../../modules/dbdump"
image = "eu.gcr.io/serlo-shared/athene2-dbdump-cronjob:3.4.2"
image = "eu.gcr.io/serlo-shared/athene2-dbdump-cronjob:3.4.3"
namespace = kubernetes_namespace.api_namespace.metadata.0.name
node_pool = module.cluster.node_pools.non-preemptible
schedule = "0 0 * * *"
Expand All @@ -77,7 +77,7 @@ module "athene2-dbdump" {
password = var.kpi_kpi_database_password_readonly
}
bucket = {
url = "gs://anonymous-data"
url = "gs://anonymous-dump"
service_account_key = module.gcloud_dbdump_writer.account_key
}
}
Expand Down
4 changes: 2 additions & 2 deletions envs/staging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module "gcloud_postgres" {

module "athene2_dbsetup" {
source = "../../modules/dbsetup"
image = "eu.gcr.io/serlo-shared/athene2-dbsetup-cronjob:3.1.2"
image = "eu.gcr.io/serlo-shared/athene2-dbsetup-cronjob:4.0.0"
namespace = kubernetes_namespace.api_namespace.metadata.0.name
node_pool = module.cluster.node_pools.preemptible
schedule = "0 2 * * *"
Expand All @@ -88,7 +88,7 @@ module "athene2_dbsetup" {
password = var.kpi_kpi_database_password_default
}
bucket = {
url = "gs://anonymous-data"
url = "gs://anonymous-dump"
service_account_key = module.gcloud_dbdump_reader.account_key
service_account_name = module.gcloud_dbdump_reader.account_name
}
Expand Down
2 changes: 1 addition & 1 deletion images/dbdump/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local_image=serlo/$(image_name)
# change version if you want to push a new image
major_version=3
minor_version=4
patch_version=2
patch_version=3
version=$(major_version).$(minor_version).$(patch_version)

include ../docker.mk
Expand Down
2 changes: 1 addition & 1 deletion images/dbdump/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ cat <<EOF | gcloud auth activate-service-account --key-file=-
${BUCKET_SERVICE_ACCOUNT_KEY}
EOF
gsutil cp dump-*.zip "${BUCKET_URL}"
log_info "latest dump ${BUCKET_URL} uploaded to serlo-shared"
log_info "latest dump ${BUCKET_URL} uploaded"

log_info "dump of serlo.org database - end"
6 changes: 3 additions & 3 deletions images/dbsetup/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
image_name=athene2-dbsetup-cronjob
local_image=serlo/$(image_name)

major_version=3
minor_version=1
patch_version=2
major_version=4
minor_version=0
patch_version=0
version=$(major_version).$(minor_version).$(patch_version)

include ../docker.mk
Expand Down
4 changes: 2 additions & 2 deletions images/dbsetup/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ done

echo $GCLOUD_SERVICE_ACCOUNT_KEY >/tmp/service_account_key.json
gcloud auth activate-service-account ${GCLOUD_SERVICE_ACCOUNT_NAME} --key-file /tmp/service_account_key.json
newest_dump_uri=$(gsutil ls -l gs://anonymous-data | grep dump | sort -rk 2 | head -n 1 | awk '{ print $3 }')
newest_dump_uri=$(gsutil ls -l gs://anonymous-dump | grep dump | sort -rk 2 | head -n 1 | awk '{ print $3 }')
[ -z "$newest_dump_uri" ] && {
log_fatal "no database dump available in gs://anonymous-data"
log_fatal "no database dump available in anonymous db dump bucket"
exit 1
}
newest_dump=$(basename $newest_dump_uri)
Expand Down
2 changes: 1 addition & 1 deletion modules/gcloud/gcloud_dbdump_reader/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "google_service_account_key" "dbdump_reader_key" {
}

resource "google_storage_bucket_iam_member" "dbdump_reader_binding" {
bucket = "anonymous-data"
bucket = "anonymous-dump"
role = "roles/storage.objectViewer"
member = "serviceAccount:${google_service_account.dbdump_reader.email}"
}
2 changes: 1 addition & 1 deletion modules/gcloud/gcloud_dbdump_writer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "google_service_account_key" "dbdump_writer_key" {
}

resource "google_storage_bucket_iam_binding" "dbdump_writer_binding" {
bucket = "anonymous-data"
bucket = "anonymous-dump"
role = "roles/storage.objectAdmin"

members = ["serviceAccount:${google_service_account.dbdump_writer.email}"]
Expand Down

0 comments on commit 709b438

Please sign in to comment.