gcloud source repos clone [REPO_NAME] [TARGET_DIR] --project=[PROJECT_ID]
where [REPO_NAME]
is Cloud Source Repository name,
[TARGET_DIR]
is where to put the source code,
and [PROJECT_ID]
is App Engine Project ID.
Install anything required by your Rails app:
sudo apt-get install libmysqlclient-dev
bundle install
Test the Rails app locally:
bundle exec rails server --port=8080
Bellow, [DOMAIN]
is your rails app domain,
while [SECRET_KEY]
is generated by
the following command:
bundle exec rails secret
Configuration file: app.yml
runtime: ruby
env: flex
entrypoint: bundle exec rackup -p $PORT
env_variables:
SECRET_KEY_BASE: [SECRET_KEY]
DOMAIN_NAME=[DOMAIN]
Configuration file: .ruby-version
2.4.1
Precompile Rails assets before deployment:
SECRET_KEY_BASE=[SECRET_KEY] DOMAIN_NAME=[DOMAIN] RAILS_ENV=production bundle exec rails assets:precompile
gcloud app deploy --project [PROJECT_ID]
Browse your app at https://[PROJECT_ID].appspot.com
.
- Cloud SQL
- Env vars for App Engine