Giter Site home page Giter Site logo

ghost-google-cloud-run's Introduction

Run Ghost on Google Cloud Run

Ghost on Google Cloud

Instructions

By default, Ghost uses a local SQLite database, and the filesystem as a storage.

In order to run Ghost as a "Stateless" app in Google Cloud Run, we need to:

  1. Use an external MySQL database
  2. Use an external storage engine

1) Use an external MySQL database

You can use whichever you want, Google Cloud MySQL, Amazon RDS, Azure MySQL, Compose MySQL, etc. I recommend using Google Cloud MySQL if you don't mind paying a small fee, to keep everything with the same provider. Personally, I chose Amazon RDS while developing, for their generous 12-months free tier. However, when I'll be ready for production, I will move to Google Cloud MySQL.

2) Use an external storage engine

You can choose Google Cloud Storage (using ghost-v3-google-cloud-storage), Amazon S3 (using ghost-storage-adapter-s3), or any other storage adapter they support. Since we'll be running in Google Cloud Run, I recommend using Google Cloud Storage. This is what this example uses.

USAGE

GCLOUD_PROJECT_ID=your-project-id sh push.sh

Now your image is waiting in your Google Container Registry, and ready to use by Google Cloud Run.

You will need to set some environment variables in your Google Cloud Run service before creating it. If you take a look at ./config.production.json, you will see that the url, the MySQL connection configs are needed, as well as the GCS bucket. Since Ghost uses nconf, you can easily set them as environment variables:

url                             = www.mydomain.com
database__connection__host      = my-db.us-east-xyz.rds.amazonaws.com
database__connection__database  = my-db
database__connection__user      = my-db-user
database__connection__password  = my-db-pass
storage__gcs__bucket            = my-google-bucket

Refer to Ghost Configuration Docs for more info.

Note about url: With Google Cloud Run, you can map your service to a custom domain. If you know in advance what it'll be, you can already set it. Otherwise, you can set it to your service's URL then restart it.

That's it! You are now running a FREE (if you used AWS RDS) Ghost blog on Google Cloud ๐ŸŽ‰

ghost-google-cloud-run's People

Contributors

markmssd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.