Skip to content

Commit

Permalink
Merge pull request #57 from keboola/PST-2374-ondra
Browse files Browse the repository at this point in the history
Backup to google storage
  • Loading branch information
ondrajodas authored Jan 22, 2025
2 parents 0b06818 + 896748c commit 78b06c6
Show file tree
Hide file tree
Showing 13 changed files with 862 additions and 19 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@ env:
KBC_DEVELOPERPORTAL_PASSWORD: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}
DOCKERHUB_USER: keboolabot
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

# AWS Credentials
TEST_STORAGE_API_URL: https://connection.eu-central-1.keboola.com/
TEST_STORAGE_API_TOKEN: ${{ secrets.TEST_STORAGE_API_TOKEN }}
TEST_AWS_ACCESS_KEY_ID: AKIAQLZBTO5VMQJGVGNK
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }}
TEST_AWS_REGION: eu-central-1
TEST_AWS_S3_BUCKET: ci-app-project-backup-s3filesbucket-7qyiq6iqfrse

# Azure Credentials
TEST_AZURE_STORAGE_API_URL: https://connection.north-europe.azure.keboola.com/
TEST_AZURE_STORAGE_API_TOKEN: ${{ secrets.TEST_AZURE_STORAGE_API_TOKEN }}
TEST_AZURE_ACCOUNT_NAME: ciappprojectbackup
TEST_AZURE_ACCOUNT_KEY: ${{ secrets.TEST_AZURE_ACCOUNT_KEY }}
TEST_AZURE_REGION: eu-west-1

# GCP Credentials
TEST_GCP_STORAGE_API_URL: "https://connection.europe-west3.gcp.keboola.com/"
TEST_GCP_STORAGE_API_TOKEN: ${{ secrets.TEST_GCP_STORAGE_API_TOKEN }}
TEST_GCP_SERVICE_ACCOUNT: ${{ secrets.TEST_GCP_SERVICE_ACCOUNT }}
TEST_GCP_BUCKET: "ci-app-project-backup"
TEST_GCP_REGION: "europe-west3"

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -92,6 +103,11 @@ jobs:
-e TEST_AZURE_ACCOUNT_NAME
-e TEST_AZURE_ACCOUNT_KEY
-e TEST_AZURE_REGION
-e TEST_GCP_STORAGE_API_URL
-e TEST_GCP_STORAGE_API_TOKEN
-e TEST_GCP_BUCKET
-e TEST_GCP_REGION
-e TEST_GCP_SERVICE_ACCOUNT
$APP_IMAGE composer ci
deploy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/vendor
/.idea
/data
.phpunit.result.cache
53 changes: 48 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,31 @@ cd app-project-backup
- `TEST_AZURE_STORAGE_API_URL` - KBC Storage with Blob Storage backend API endpoint
- `TEST_AZURE_STORAGE_API_TOKEN` - KBC Storage with Blob Storage backend API token
- `TEST_AZURE_ACCOUNT_` - Storage Account in your Azure Subscription
- `TEST_GCP_STORAGE_API_URL` - KBC Storage with Google backend API endpoint
- `TEST_GCP_STORAGE_API_TOKEN` - KBC Storage with Google backend API token
- `TEST_GCP_SERVICE_ACCOUNT` - Service account with permissions to write to the bucket
- `TEST_GCP_BUCKET` - Bucket in your Google Storage
- `TEST_GCP_REGION` - KBC Storage with Google backend region

```
TEST_STORAGE_API_URL=
TEST_STORAGE_API_TOKEN=
TEST_AWS_ACCESS_KEY_ID=
TEST_AWS_SECRET_ACCESS_KEY=
TEST_AWS_REGION=
TEST_AWS_S3_BUCKET=
TEST_STORAGE_API_URL=
TEST_STORAGE_API_TOKEN=
TEST_AZURE_REGION=
TEST_AZURE_STORAGE_API_URL=
TEST_AZURE_STORAGE_API_TOKEN=
TEST_AZURE_REGION=
TEST_AZURE_ACCOUNT_NAME=
TEST_AZURE_ACCOUNT_KEY=
TEST_GCP_STORAGE_API_URL=
TEST_GCP_STORAGE_API_TOKEN=
TEST_GCP_SERVICE_ACCOUNT=
TEST_GCP_BUCKET=
TEST_GCP_REGION=
```

- Build Docker image
Expand Down Expand Up @@ -156,6 +166,23 @@ docker-compose run --rm dev composer ci
}
```


- GCP example (Generate Read Credentials action)
```json
{
"action": "generate-read-credentials",
"parameters": {
"backupId": null
},
"image_parameters": {
"storageBackendType": "gcs",
"#jsonKey": "",
"#bucket": "",
"region": "europe-west4"
}
}
```

- AWS example (Backup action)
```json
{
Expand Down Expand Up @@ -189,7 +216,23 @@ docker-compose run --rm dev composer ci
}
}
```



- GCP example (Backup action)
```json
{
"action": "run",
"parameters": {
"backupId": "backupId from `generate-read-credentials` action - if not set will be created"
},
"image_parameters": {
"storageBackendType": "gcs",
"#jsonKey": "",
"#bucket": "",
"region": "europe-west4"
}
}
```
# Integration

For information about deployment and integration with KBC, please refer to the [deployment section of developers documentation](https://developers.keboola.com/extend/component/deployment/)
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"license": "MIT",
"require": {
"php": "^8.2",
"keboola/kbc-project-backup": "^1.13",
"google/apiclient": "^2.18",
"keboola/kbc-project-backup": "^1.14",
"keboola/php-component": "^10.1",
"keboola/php-file-storage-utils": "^0.2.6",
"microsoft/azure-storage-blob": "^1.5"
Expand Down
Loading

0 comments on commit 78b06c6

Please sign in to comment.