2.5 KiB
Setting up a dev environment
Assumptions
You have a package manager, and your system is systemd-based.
Prerequisites
Nodejs
Install nodejs via your package manager. We used v19.1.0 for this setup.
Ruby
Install ruby via your package manager of choice.
Ruby Extras
Your distro may package bundle
and irb
in separate packages (Arch does). If they are, install them too.
On Arch these are ruby-bundler
and ruby-irb
.
PostGreSQL
Install postgres via your package manager.
Enable and start the default postgresql.service
Redis
Install redis via your package manager.
Enable and start the default redis.service
Pre-Work
In the following instructions, replace USER with your *nix user name.
- Give the postgres user rwx on your home folder. We used
sudo setfacl -m u:postgres:rwx /home/USER
. - Set up your user for postgres db creation with
sudo -u postgres createuser USER --createdb
. - Navigate to the root of this repo
- Run `bundle config set --local path 'vendor/bundle'. This will store the all the ruby gems locally so that we can avoid interfering with system config.
- Run
bundle install
. - Run
yarn install
. - Run
bundle exec rake db:setup
. If this fails, you can usebundle exec rake db:reset
to forcibly regenerate it.
Getting it running
To make our lives easier, we'll use foreman
to run the site, so use gem install foreman
to get that going.
Then:
- Run
export RAILS\_ENV=development
andexport NODE\_ENV=development
. a. Put these in your shell's .rc, or a script you can source if you want to skip this step in the future. - Run
bundle exec rake assets:precompile
. a. If this explodes, complaining aboutHash
, you'll need toexport NODE\_OPTIONS=--openssl-legacy-provider
. Same deal as the above. b. After doing this, you will need tobundle exec rake assets:clobber
and then re-runbundle exec rake assets:precompile
. - Run
foreman start
Updates/Troubleshooting
RubyVM/DebugInspector Issues
Still unable to fix. Circumvent by removing better\_errors
and binding\_of\_caller
from Gemfile.
Happy to troubleshoot with someone better with Ruby than us >_<'/.
Webpack Issues
If Webpack compalins about being unable to find some assets or locales:
- yarn add webpack
- git restore package.json yarn.lock
- yarn install
Then re-run foreman
. No. We have no idea why this worked.
If the above instructions don't work, please contact @Rin here, or @tammy@social.treehouse.systems.