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.
Packages can be stored in Google Cloud Storage.
Follow the instructions in Using Cloud Storage to create a bucket.
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"
},
...
}
baget. This can be done through the Google Cloud Console. Use utf8mb4 as the Character set.openssl pkcs12 -inkey client-key.pem -in client-cert.pem -export -out client.pfx
appsettings.json file:{
...
"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"
},
...
}
RunMigrationsAtStartup, on by default).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:
PROJECT - your GCP project, as returned by gcloud config get-value projectREGION – the GCP region your Google Cloud SQL database is in, e.g., us-central1 or us-west2DBINSTANCE – the name of your Google Cloud SQL database instanceDBNAME – the name of the BaGet Extension database on that instance (e.g., baget in the instructions above)PASSWORD – the password for the database root userBUCKETNAME – the name of the Google Cloud Storage Bucket configured aboveruntime: 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.
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.