Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for google cloud #3821

Merged
merged 19 commits into from
Dec 28, 2022

Conversation

mattlindsey
Copy link
Collaborator

Modifications to allow running the site on docker locally and on Google Cloud.

It's currently dying on trying to connect to Google Cloud SQL postgres with this:
PG::ConnectionBad: could not connect to server: No such file or directory

It seems to happen first when 'rake db:setup' tries to create the db and do migrations. And the postgres logs don't show it hitting the database. And the 'websiteone-production' db doesn't get created unless I do it manually.

I have checked a lot of things, and it may be a problem with the encrypted db password using the 'master key' method in rails, but I also seem to get the error just defining the password in the cloud service. Possibly the master key or 'rails secret key' didn't get saved correctly.

@mtc2013
Copy link
Member

mtc2013 commented Dec 21, 2022

have a look at this for sql issues

https://dev.to/ku6ryo/access-cloud-sql-from-docker-on-cloud-run-41b6

@mattlindsey
Copy link
Collaborator Author

Also this for postgres stuff needed
https://dev.to/ku6ryo/access-cloud-sql-from-docker-on-cloud-run-41b6

@mattlindsey mattlindsey changed the title WIP 3820 google cloud Add support for google cloud Dec 22, 2022
@mattlindsey
Copy link
Collaborator Author

I think this looks good now.
Turns out this doc was the latest/best way to do it, rather than the older 4 step tutorial which is more complicated:
https://cloud.google.com/ruby/rails/run

features/support/fixtures/cassettes/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to put this re-enabling of vcr in this pr?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually looks like I just accidentally removed the last blank line, which doesn't seem to hurt anything

Gemfile Outdated
@@ -36,6 +36,7 @@ gem 'faker'
gem 'font-awesome-rails'
gem 'friendly_id'
gem 'geocoder'
gem 'google-cloud-storage'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this in this pr?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try taking all of the cloud storage stuff out. There's a chance that it's necessary for asset pipeline, but hopefully not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it out.

@@ -2,6 +2,7 @@

require_relative 'boot'
require 'rails'
require "active_storage/engine"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we end up needing this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it out.

# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# [START cloudrun_rails_storage]
google:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this in here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it out.

@@ -0,0 +1,48 @@
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we don't need this in this pr?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it out.

# [START cloudrun_rails_base_image]
# Pinning the OS to buster because the nodejs install script is buster-specific.
# Be sure to update the nodejs install command if the base image OS is updated.
FROM ruby:3.0-buster as base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we running 3.0.5 here with this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think they keep 'buster' up with the 'stable' version of ruby 3.0.x

@mattlindsey
Copy link
Collaborator Author

fixes #3819
fixes #3813

@mattlindsey
Copy link
Collaborator Author

@mtc2013. See it this looks good now. We should squash the commits when merging since there's so many.

Copy link
Member

@mtc2013 mtc2013 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's pull this in and open a ticket for streamlining the deploy to google cloud. It's not a showstopper since we're not doing continuous delivery right now, nor do we have a production site.

@mtc2013 mtc2013 merged commit 1701a71 into AgileVentures:develop Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants