Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-db/migrate_gcp.sh
2492 views
1
#!/bin/bash
2
# Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
# Licensed under the GNU Affero General Public License (AGPL).
4
# See License.AGPL.txt in the project root for license information.
5
6
# This scipt connects via Google's cloud_sql_proxy to a database and runs the db-migrations
7
8
# ENV variables for configuration:
9
# * GOOGLE_APPLICATION_CREDENTIALS_DATA: contents of the crendetials files that cloud_sql_proxy uses for authentication
10
# * GCP_DATABASE: database name
11
# * DB_PASSWORD: database password
12
13
# Example usage:
14
# docker run --rm \
15
# --env GOOGLE_APPLICATION_CREDENTIALS_DATA='...' \
16
# --env GCP_DATABASE="gitpod-foobar:europe-west1:gitpod-foobar-baz" \
17
# --env DB_PASSWORD="..." \
18
# gcr.io/gitpod-core-dev/build/db-migrations:x1 /app/migrate_gcp.sh
19
20
set -euo pipefail
21
22
/app/typeorm_gcp.sh migrations:run
23
24