# Hello from Gitpod! (installing on google cloud + automated dev setup)

**URL:** https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783
**Category:** Self-hosting
**Created:** [September 17, 2019, 11:54am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783 "2019-09-17T11:54:32Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![jankeromnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jankeromnes/32/117299_2.png) [@jankeromnes](https://meta.discourse.org/u/jankeromnes)
#### Post date: [September 17, 2019, 11:54am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/1 "2019-09-17T11:54:32Z")

</div>

Hello Discourse community! 👋

I work on [gitpod.io](http://gitpod.io), a free one-click IDE for GitHub. We currently use Spectrum for our community, but we have some troubles with it and we’d love to stand up a Discourse instance to play with it and potentially migrate.

We’d like to use our Google Cloud account for that, if possible. Could you please point me in the right direction? E.g. is the new Google Cloud Run a good fit for running a Discourse instance?

Also, since our mission is to fully automate all dev setups (at least for open source projects), I’d like to contribute a fully-automated setup for Discourse, allowing contributors to start a ready-to-code Discourse environment online in one click (as opposed to reading through long lists of setup instructions and manually installing/configuring a bunch of dependencies on your current device). I’ve already started to work on this based on @notriddle’s (hi!) excellent [automated Discourse setup for Janitor](https://discourse.janitor.technology/t/discourse-image-is-pretty-awesome/121?u=jan).

I’m currently facing a problem though, since recently the setup instructions fail on a missing “polls” table. Not sure how to fix that yet, but I’ll continue investigating. Just thought I’d mention it here.

---

<div class="post-metadata">

### Author: ![marianord](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marianord/32/90502_2.png) [@marianord](https://meta.discourse.org/u/marianord)
#### Post date: [September 17, 2019, 12:24pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/2 "2019-09-17T12:24:06Z")

</div>

> [@jankeromnes](#):
>
> is the new Google Cloud Run a good fit for running a Discourse instance?

I could be, but it’s not that easy. Discourse is not a stateless container which is what Google Cloud Run is made for, therefore you’ll need a way to add some kind of Persistent Volume for the data that’s kept in Discourse (uploads, avatars, DB).

I’d use a normal Google Compute instance and that’s it. With some kind of script, or infrastructure management tools you should be able to automate the deployment of a new Discourse instances, this guide [Install Discourse on Ubuntu or Debian for Development](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727) might also help you.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [September 17, 2019, 12:54pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/3 "2019-09-17T12:54:39Z")

</div>

> [@jankeromnes](#):
>
> I’m currently facing a problem though, since recently the setup instructions fail on a missing “polls” table. Not sure how to fix that yet, but I’ll continue investigating. Just thought I’d mention it here.

Which setup instructions are you using? If the polls table is missing, it suggests you have not run the plugin migrations. They should be run automatically in development mode. In test mode, you need to add `LOAD_PLUGINS=1` before the `rake db:migrate` command

---

<div class="post-metadata">

### Author: ![jankeromnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jankeromnes/32/117299_2.png) [@jankeromnes](https://meta.discourse.org/u/jankeromnes)
#### Post date: [September 17, 2019, 1:49pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/4 "2019-09-17T13:49:19Z")

</div>

Thanks for your replies @marianord and @david!

> [@marianord](#):
>
> I’d use a normal Google Compute instance and that’s it.

That does sound more reasonable than using Cloud Run, since extracting all the state from Discourse containers could take some time. Thanks for pointing me to the guide! I’ll try to follow it to set up a Compute instance, and report back here with my findings.

> [@david](#):
>
> Which setup instructions are you using?

I’m following [https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md](https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md).

The exact error I saw was:

```
== Seed from /workspace/discourse/db/fixtures/990_settings.rb
Discourse hostname: localhost is not a valid domain for emails!

== Seed from /workspace/discourse/db/fixtures/990_topics.rb
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "polls" does not exist
LINE 8: WHERE a.attrelid = '"polls"'::regclass
                            ^

```

While trying to do:

```
bundle exec rake db:create db:migrate &&
RAILS_ENV=test bundle exec rake db:create db:migrate

```

I’ve also experimented with adding this line:

```
RAILS_ENV=development bundle exec rake db:create db:migrate

```

but to no avail.

> [@david](#):
>
> If the polls table is missing, it suggests you have not run the plugin migrations. They should be run automatically in development mode. In test mode, you need to add `LOAD_PLUGINS=1` before the `rake db:migrate` command

Thanks a lot for the tip! I’ll try that, and report back here as well. (Sorry for asking two questions in one! Hopefully it won’t make the discussion too confusing.)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 17, 2019, 2:26pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/5 "2019-09-17T14:26:22Z")

</div>

> [@jankeromnes](#):
>
> I’m following [discourse/DEVELOPER-ADVANCED.md at master · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md)

The developer install is much slower and designed for…development. So you’ll want to follow the [standard install](https://meta.discourse.org/t/142537?silent=true) instructions. It’s easy enough to automate. My install service is now fully automated (except for the dns settings required by mailgun because I don’t have control over client dns).

The hard part of installing is mail configuration.

Also, installation and maintenance are different.

---

<div class="post-metadata">

### Author: ![jankeromnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jankeromnes/32/117299_2.png) [@jankeromnes](https://meta.discourse.org/u/jankeromnes)
#### Post date: [September 17, 2019, 2:46pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/6 "2019-09-17T14:46:17Z")

</div>

> [@pfaffman](#):
>
> The developer install is much slower and designed for…development. So you’ll want to follow the [standard install](https://meta.discourse.org/t/142537?silent=true) instructions.

Thanks @pfaffman! Sorry about the confusion, I mixed up two things in my original message: 1) installing Discourse for the Gitpod community, and 2) automating the dev setup for Discourse developers and contributors. I’m thankfully following the developer guide for 2), not for 1). 😅

> [@david](#):
>
> If the polls table is missing, it suggests you have not run the plugin migrations. They should be run automatically in development mode. In test mode, you need to add `LOAD_PLUGINS=1` before the `rake db:migrate` command

@david Hmm, unfortunately, with:

```
bundle exec rake db:create db:migrate &&
RAILS_ENV=test LOAD_PLUGINS=1 bundle exec rake db:create db:migrate

```

It still fails with:

```
== Seed from /workspace/discourse/db/fixtures/990_settings.rb
Discourse hostname: localhost is not a valid domain for emails!

== Seed from /workspace/discourse/db/fixtures/990_topics.rb
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "polls" does not exist
LINE 8: WHERE a.attrelid = '"polls"'::regclass
                            ^

```

Did I understand your suggestion correctly? Would you have other ideas on how to fix it? (I tried to drop the tables beforehand, but that failed with a different error which I don’t remember. Happy to try again though.)

Also, I forgot to mention that my setup instructions worked until last week or so, so the error appeared recently after a Discourse rebase. I think after the migration to Rails 6 maybe? [DEV: Upgrade Discourse to Rails 6 (#8083) · discourse/discourse@32b8a2c · GitHub](https://github.com/discourse/discourse/commit/32b8a2ccffd50d78b8f7be6f0b524506cd2dbd7e)

FYI, you can easily reproduce the error by trying to open my Discourse fork in Gitpod: [Dashboard](https://gitpod.io/#https://github.com/jankeromnes/discourse) . You’ll see my automated setup fail, and get an interactive environment where one can try various Discourse commands in the Terminal.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [September 17, 2019, 3:39pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/7 "2019-09-17T15:39:00Z")

</div>

@sam It looks like [FIX: Rails 6 multisite migrations and plugin migrations · discourse/discourse@025d4ee · GitHub](https://github.com/discourse/discourse/commit/025d4ee91f4727540c749e2162680e1042c34376) broke something.

Contrary to the commit message, I think plugin migrations were working before this commit. They aren’t anymore. It doesn’t matter if the `LOAD_PLUGINS=1` is provided or not – plugin migrations aren’t running in my dev environment.

I believe it’s because of this:

```diff
--- a/lib/plugin/instance.rb
+++ b/lib/plugin/instance.rb
@@ -516,7 +516,7 @@ class Plugin::Instance
     Rake.add_rakelib(File.dirname(path) + "/lib/tasks")
 
     # Automatically include migrations
- migration_paths = Rails.configuration.paths["db/migrate"]
+ migration_paths = ActiveRecord::Migrator.migrations_paths
     migration_paths << File.dirname(path) + "/db/migrate"
 
     unless Discourse.skip_post_deployment_migrations?

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 17, 2019, 3:58pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/8 "2019-09-17T15:58:08Z")

</div>

> [@jankeromnes](#):
>
> installing Discourse for the Gitpod community,

So that’s [INSTALL-cloud](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md).

> [@jankeromnes](#):
>
> automating the dev setup for Discourse developers and contributors.

Imagine that there was a docker container that was included with Discourse and you could just use it without installing anything.

> [@Install Discourse for development using Docker](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009):
>
> Developing using Docker Since Discourse runs in Docker, you should be able to run Discourse directly from your source directory using a Discourse development container. white_check_mark Pros: No need to install any system dependencies, no configuration needed at all for setting up a development environment quickly. x Cons: Will be slightly slower than the native dev environment on Ubuntu, and much slower than a native install on MacOS. See also [Developing Discourse using a Dev Container](https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366) …

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 17, 2019, 9:56pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/9 "2019-09-17T21:56:23Z")

</div>

I have seen this error on the multisite migrate, on dev/test db it is fine, going to debug it carefully today

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 18, 2019, 3:20am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/11 "2019-09-18T03:20:02Z")

</div>

Per:

[https://github.com/discourse/discourse/commit/1ca257be791de2b7806d06354f392585d83108a3](https://github.com/discourse/discourse/commit/1ca257be791de2b7806d06354f392585d83108a3)

This should make the dev envs behave right when following guides.

@kris.kotlarek can you have a look at that commit … why did schema dump → load stop working in Rails 6 with our plugins?

---

<div class="post-metadata">

### Author: ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)
#### Post date: [September 18, 2019, 3:43am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/12 "2019-09-18T03:43:21Z")

</div>

Sure, I will check it tonight

---

<div class="post-metadata">

### Author: ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)
#### Post date: [September 18, 2019, 9:20am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/13 "2019-09-18T09:20:19Z")

</div>

I think I found problem for `ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "polls" does not exist`  
When `load_config` is evaluated on database creation, it overrides `migrations_paths`

 ![Screenshot%20from%202019-09-18%2019-00-05](https://global.discourse-cdn.com/meta/original/3X/d/5/d54cee04fa16ec99f86ad743077a97ae248a8011.png)

So this is what is happening when we try to evaluate `db:create` and `db:migrate` at the same time:

 ![Screenshot%20from%202019-09-18%2017-49-30](https://global.discourse-cdn.com/meta/original/3X/d/1/d1529093b4f5944e16e8a733c87cf5925b864222.png)

However, if we run them separately, paths are fine:

 ![Screenshot%20from%202019-09-18%2017-50-17](https://global.discourse-cdn.com/meta/original/3X/2/b/2b19f5cbc03533aa21f5e376b62a4ae5e8122105.png)

I think we got two options here:

1. Change guides and recommend to use two commands separately
2. Monkey patch and use `||=`

What do you think?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 18, 2019, 11:13am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/14 "2019-09-18T11:13:00Z")

</div>

Will that sort out?

```
RAILS_ENV=test bin/rake db:migrate
RAILS_ENV=test bin/rake db:schema:dump
dropdb discourse_test
createdb discourse_test
RAILS_ENV=test bin/rake db:schema:load
RAILS_ENV=test bin/rake db:migrate

```

---

<div class="post-metadata">

### Author: ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)
#### Post date: [September 18, 2019, 11:24am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/15 "2019-09-18T11:24:14Z")

</div>

This would solve the original problem about missing `polls` table mentioned here: [Hello from Gitpod! (installing on google cloud + automated dev setup) - #4 by jankeromnes](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/4)  
The same problem was mentioned in that topic: [Install Discourse on Ubuntu or Debian for Development - #320](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727/320)

I started debugging that code about populating test DB but I got lost. For some reasons, after the schema is loaded, when calling `db:migrate`, Rails still wants to evaluate migrations and we got an error that table already exists. So far, I couldn’t find a reason

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 18, 2019, 11:26am UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/16 "2019-09-18T11:26:13Z")

</div>

I see let’s adjust the guides then for now for the op

---

<div class="post-metadata">

### Author: ![jankeromnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jankeromnes/32/117299_2.png) [@jankeromnes](https://meta.discourse.org/u/jankeromnes)
#### Post date: [September 18, 2019, 1:51pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/17 "2019-09-18T13:51:05Z")

</div>

Thanks a lot for looking into this bug! 👍 I will use the updated instructions to work around it for now.

> [@pfaffman](#):
>
> Imagine that there was a docker container that was included with Discourse and you could just use it without installing anything.

Aha, interesting, thanks! I’ll have a look at the existing development Dockerfiles to see if they can simply be spawned in one click by Gitpod. 😄 That would be cool.

---

<div class="post-metadata">

### Author: ![jankeromnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jankeromnes/32/117299_2.png) [@jankeromnes](https://meta.discourse.org/u/jankeromnes)
#### Post date: [September 18, 2019, 2:43pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/18 "2019-09-18T14:43:18Z")

</div>

Interestingly, splitting `db:create` and `db:migrate` into two separate commands, as suggested in [Install Discourse on Ubuntu or Debian for Development - #321](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727/321), also “worked”.

(But now, `DISCOURSE_DEV_HOST=.gitpod.io bundle exec rails s -b 0.0.0.0` seems to crash-loop with:

```plaintext
/workspace/.rvm/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:551:in `load_missing_constant': Unable to autoload constant Version, expected /workspace/discourse/lib/version.rb to define it (LoadError)

```

and the web server started blocking my Gitpod preview URL again:

```plaintext
Blocked host: 3000-a8a71720-4c30-466b-aea5-5344c97c4e94.ws-eu0.gitpod.io

```

)

---

<div class="post-metadata">

### Author: ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)
#### Post date: [September 18, 2019, 8:37pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/19 "2019-09-18T20:37:08Z")

</div>

I created a pull request with a fix for that problem: [FIX: Remove Versions from Active Record warm up by KrisKotlarek · Pull Request #8105 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/8105)

Could you check if that solves the problem on your machine? (It is working now on my local)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 18, 2019, 9:40pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/20 "2019-09-18T21:40:14Z")

</div>

I just changed that env var to have a s at the end

[https://review.discourse.org/t/dev-support-multiple-hosts-in-dev/5713](https://review.discourse.org/t/dev-support-multiple-hosts-in-dev/5713)

---

<div class="post-metadata">

### Author: ![KajMagnus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kajmagnus/32/49264_2.png) [@KajMagnus](https://meta.discourse.org/u/KajMagnus)
#### Post date: [February 7, 2020, 9:41pm UTC](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783/21 "2020-02-07T21:41:25Z")

</div>

> [@jankeromnes](#):
>
> We currently use Spectrum for our community, but we have some troubles with it

Hi Jan, if you have time, I’m curious about what were the problems / didn’t work out the way you had hoped, with Spectrum?

I’ve been following Spectrum a little bit, reading about them from time to time.

(I tried to send you a PM about this, but for some reason when I click your profile, there’re no send-private-message button.)

[Next page](https://meta.discourse.org/t/hello-from-gitpod-installing-on-google-cloud-automated-dev-setup/128783.md?page=2)
