Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Better installation docs #9

Closed
guidopetri opened this issue Jan 4, 2020 · 3 comments
Closed

Better installation docs #9

guidopetri opened this issue Jan 4, 2020 · 3 comments

Comments

@guidopetri
Copy link
Contributor

guidopetri commented Jan 4, 2020

This is kind of a collection of things I had to do to install Journal on a VPS.

  • no need for yarn install
  • skipped installing with homebrew (why would I install this on linux if I don't need it? Installed by running the script's commands manually:
    • created a linux user for journal
    • created a postgres user for journal with sudo -u postgres createuser -D -A -P journal
    • followed these instructions to install ruby (2.6.5) and bundler
    • cloned the journal repo and exported the correct ENV variables with the journal user
    • created + migrated the db with rake
    • switched to RAILS_ENV="production", which meant also editing the config/environments/production.rb file:
      • added config.hosts << my.host.tld
      • commented out config.assets.compile = false
    • changed port in config/puma.rb from 3000 to my own value (I actually think this can be set later when you call rails, but I'm not sure)

Then, running bundle exec rails s in the folder as the user journal should work for launching the application. To make it a systemd service was a little more complex. This is what the service file ended up looking like:

[Unit]
Description=InodaJournal
After=network.target

[Service]
Type=simple
User=journal
Group=journal
WorkingDirectory=/home/journal/journal
Environment="JOURNAL_DATABASE_PASSWORD=..."
Environment="CIPHER_KEY=..."
Environment="SHARING_TOKEN_CIPHER_IV=..."
Environment="RAILS_ENV=production"
Environment="SECRET_KEY_BASE=..."
Environment="PATH=/your/full/journal/user/path"
ExecStart=/home/journal/.rbenv/bin/rbenv exec bundle exec rails s
TimeoutSec=30
RestartSec=15s
Restart=always

[Install]
WantedBy=multi-user.target

The one thing that got me with systemd was that initially I was missing bash in my PATH, so the service was just returning a 127 error code. I found out that bash was missing by looking at journalctl -b logs.

This basically was installing Journal on a VPS without homebrew (not required) and without Docker, setting it up as a system service. If you want, I can try to write this into a .md and make a PR, but I'd just figure I'd write this down first of all so that if anyone ever wants to do the same, they have something to rely on.

@guidopetri
Copy link
Contributor Author

Looks like my installation still isn't perfect - sharing posts isn't working. It's not super ideal to mention in the install instructions that you need to call some ruby functions to get random bytes in base64 - maybe this could be done in shell instead?

Also, why do you need specifically 32/64 random bytes? Is this a Puma/Ruby/Rails thing, or something set by the application?

@guidopetri
Copy link
Contributor Author

All this being said... I absolutely love the application. Thank you for putting this out there! I'm definitely going to use it a lot.

@inoda
Copy link
Owner

inoda commented Jan 4, 2020

@charlesoblack Thanks for calling this stuff out! And glad you like the app. The install steps are by no means perfect - there is now a Docker install which might solve some of this pain.

yarn install should be removed from install steps now - that was an error on my part.

For the keys - they need to be a specific length. This is required by the openssl gem that is used for encrypting contents. They are base64 encoded just so they work as ENV vars.

Screen Shot 2020-01-04 at 3 43 15 PM

As for everything else you called out, I'm not very familiar with setting up systemd and whatnot, would definitely accept a PR with more installation options!

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants