I work on 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.
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.
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 might also help you.
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
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.
== 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
^
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.)
The developer install is much slower and designed for…development. So you’ll want to follow the standard install 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.
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).
== 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.)
FYI, you can easily reproduce the error by trying to open my Discourse fork in Gitpod: Dashboard . You’ll see my automated setup fail, and get an interactive environment where one can try various Discourse commands in the Terminal.
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 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
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
Thanks a lot for looking into this bug! I will use the updated instructions to work around it for now.
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.
(But now, DISCOURSE_DEV_HOST=.gitpod.io bundle exec rails s -b 0.0.0.0 seems to crash-loop with:
/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: