BaGet

Run BaGet Extension on Google Cloud Platform

We’re open source and accept contributions! Fork this repository on GitHub.

Before you begin, you should decide which AppEngine region you will use. For best performance, Cloud Storage and Cloud SQL should be located in the same region as your AppEngine deployment.

Google Cloud Storage

Packages can be stored in Google Cloud Storage.

Setup

Follow the instructions in Using Cloud Storage to create a bucket.

Configuration

NOTE: If you plan to use AppEngine, skip this part and follow the AppEngine instructions below.

Set up a service account and download credentials. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path to the JSON file you downloaded.

Configure BaGet Extension to use Google Cloud Storage by updating the appsettings.json file:

{
    ...

    "Storage": {
        "Type": "GoogleCloud",
        "BucketName": "your-gcs-bucket"
    },

    ...
}

Google Cloud SQL

{
    ...
    "Database": {
        "Type": "MySql",
        "ConnectionString": "Server=YOURIP;User Id=root;Password=***;Database=baget;CertificateFile=C:\\Path\\To\\client.pfx;CACertificateFile=C:\\Path\\To\\server-ca.pem;SSL Mode=VerifyCA"
    },
    ...
}

Google AppEngine

BaGet Extension can be hosted in Google AppEngine. See here for a tutorial on how to create a new AppEngine project.

Create a app.yaml file to publish the Docker container built by the Dockerfile in this repo. In the template below, make the following replacements:

runtime: custom
env: flex

# The settings below are to reduce costs during testing and are not necessarily
# appropriate for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/dotnet/configuring-your-app-with-app-yaml
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

beta_settings:
  cloud_sql_instances: "PROJECT:REGION:DBINSTANCE"

env_variables:
  Database__Type: "MySql"
  Database__ConnectionString: "Server=/cloudsql/PROJECT:REGION:DBINSTANCE;User Id=root;Password=PASSWORD;Database=DBNAME;SslMode=None"
  Storage__Type: "GoogleCloud"
  Storage__BucketName: "BUCKETNAME"
  Search__Type: "Database"
  Kestrel__Endpoints__Http__Url: "http://+:8080"

Kestrel:Endpoints in appsettings.json takes precedence over ASPNETCORE_URLS, so set the Kestrel URL instead.

To publish the application, run gcloud app deploy.

Publish packages

With an empty ApiKey and accounts on (the default), a push needs a user API key from /account/apikeys; or set ApiKey (for example ApiKey: "..." in env_variables) and pass it with -k. See Require an API key.