I wanted to build and test a development instance of glitch-soc
, a friendly fork of Mastodon. I succeeded. But I am very tired now. Here are my notes, along with some after-the-fact editorializing.
It’s less tutorial and more confessional. I haven’t used Rails much since 4.0 was shiny. So there’s likely some common practice workflow that I don’t know yet. But I got it to work.
Install glitch-soc locally
glitch-soc
documentation refers you to Mastodon docs, Mastodon’s installation instructions seem focused on production installations. I bounce back and forth between Mastodon’s README and its developer documentation.
The README says I need:
- PostgreSQL 9.5+
- Redis 4+
- Ruby 2.5+
- Node.js 10.13+
rbenv and nvm help with the language requirements, but this fresh Manjaro partition lacks the other requirements.
Install Redis
Used the Arch wiki as a guide. Didn’t need to edit config, though. Instance installed via Pamac is already configured to only listen to 127.0.0.1
.
- Version installed
- 6.0
Install Postgresql
Once again, going off the Arch wiki entry.
That reminds me. I want to finish reading The Art of PostgreSQL.
- Version installed
- 12.2
Clone project and install dev dependencies
Not the required services. I just installed those. Languages and libraries.
fork & clone repo
Since I hope to contribute bug fixes someday, I’ll fork the repo rather than just clone it. I clone my fork instead.
Dev language is weird.
The project’s .ruby-version
file specifies Ruby 2.6.6. Rbenv immediately
warns me that I lack the correct installed version. It also doesn’t recognize
the version when I try installing it, so I must refresh ruby-build.
2.6.6 is a bit more specific than “2.5+” but no big deal. Got the right Ruby version. Time to install the gems.
Oh hey what’s this? It seems relevant to my IndieWeb interests:
Adding a task to look more closely at microformats-ruby. It’s more active than mf2py.
Yarn manages the node-specific project dependencies. Better install that.
Okay now I can install the Node stuff.
At some point I should enable automatic nvm use
. Meanwhile I’ll just install.
NOTE
Or maybe I could play with Volta. Not today. Maybe later.
No complaints about Node.js versions now. Good. Time to actually set up the application?
Dev docs say rails db:setup
, so that’s what I type.
Oh right. Because I’m not using a fresh Rails app, but an existing project. I could use bundle exec
but for some reason I feel stubborn. I must make at least one step of my installation process match the documentation.
I use direnv, so I can add the path locally.
Then I need to let direnv know this change is acceptable.
There’s probably a better Rails-specific or Zsh-specific approach, but I’m in a hurry.
Loads of text follows. That’s good, right?
Instructions go straight to running the application, but that’s not my style.
Getting tests to pass
I want to run tests first. Blame Perl. I have certain expectations after years of watching cpan
run tests before declaring something installed.
Mhm. That’s what I thought. I’m going to need to write a post about getting this to work, aren’t I?
Let’s skip the hour or two of flailing and digging into past glitch-soc
and Mastodon tickets.
The problem? Webpacker doesn’t compile assets for the test environment, because CircleCI already does that.
Set compile
to true
and everything passes. Except they need that as false
for CircleCI. That — does this mean they never run any tests locally in development? That tests only run after a commit is pushed?
Inconceivable. The very thought is like fingernails on a chalkboard. Surely I missed something in the documentation.
Well I’m going to run tests locally one way or another.
Gimme a second.
Okay how about this?
First, clean up the compiled assets from my config experiment.
Next, precompile the assets and run tests again.
Huzzah! Aside from that ghastly test time. I’ve seen worse. I’ve written worse.
Clearly I need to automate this. Maybe something to do with Foreman. Maybe just a shell script that clobbers, precompiles, and runs tests.
A real fix — if one is needed, and I didn’t just miss a vital paragraph of documentation — would be to give CircleCI its own environment distinct from the default test environment.
Good enough
Will I actually do anything with my glitch-soc
fork? No idea. But I want to share this for other dusty Ruby folks whose Rails applications predate Webpack.
I should at least fiddle with instance settings enough to get a cute screenshot.
Backlinks
Got a comment? A question? More of a comment than a question?
Talk to me about this page on: mastodon
Added to vault 2024-01-15. Updated on 2024-02-01