The directions below get you to a point where you can run the app with a test-seeded database.
If you see a spot in the docs that's confusing or could be improved, please pay it forward by making a pull request!
- Fork the Repo: Go to https://github.com/DARIAEngineering/dcaf_case_management and hit the
fork
button up in the top right. - Clone the repo to your machine: Copy the URL for your fork and run:
git clone YOUR_FORK_URL
to pull it down to your local system. Change into the repo directory withcd dcaf_case_management
. - Add the Daria repo as a remote:
git remote add upstream https://github.com/DARIAEngineering/dcaf_case_management
. This will let you update when the source repo changes by running the commandgit pull upstream main
.
For the rest of the setup, you have two options: Docker, or installing everything locally. We recommend Docker if you're comfortable with its ecosystem.
We've dockerized this app, to manage the dependencies and save us some headache. If you've got Docker installed already, you can be up and running with three commands:
docker compose build # (this may say 'uses an image, skipping' a few times, that's OK)
docker compose run --rm web rails db:drop db:create db:migrate db:seed # to populate the database
docker compose up
The last command will take a moment and should print a number of things. When it's ready to go, it should say something like:
web_1 | [1] * Listening on tcp://0.0.0.0:3000
This runs the app on http://localhost:3000
and you can hit it like a regular rails server. The first time you view a page will
take a minute or two for resources to compile and load, but it should eventually load. You can log in with the user [email protected]
and the password AbortionsAreAHumanRight1
.
Any errors will show up in your terminal in the window you are running the up
command in.
If the server won't start, it may not have cleanly shut down. Run rm tmp/pids/server.pid
to remove the leftover server process and run docker compose up
again.
If you're using a Windows 10 machine to run docker, we strongly suggest downloading and using Docker-Desktop. The Docker-Desktop experience on Windows 10 is mostly very smooth these days, but there are a couple common "gotchas" we've seen while developing this (and other) apps. One of our core maintainers keeps additional info on this here. If you run into issues that are not covered there, or if you have suggestions to improve the readability of the repo, please let us know! We're happy to help debug, and once we understand the issues you've seen, you'll have helped future users who may encounter the same issue.
To fix this, you need to enable experimental features for Docker:
- Right click Docker icon in the Windows System Tray
- Go to Settings
- Go to Daemon
- Check Experimental features
- Hit Apply
If you prefer a local environment, totally cool! We recommend the following, but you'll need to adapt to your exact machine.
- Install:
- Git, python2, & openssl-dev
- Ubuntu:
sudo apt install git python2 openssl libssl-dev
- Mac:
brew install git python2 openssl
- Make sure you have a ruby version manager installed; we recommend either rbenv or rvm.
- Install our version of Ruby!
rbenv install
orrvm install $(cat .ruby-version)
should do the trick, depending on what you're using.
- Set up a node verion manager; we recommend nvm.
- Install our version of node with
nvm install
. - Install Yarn locally (
brew install yarn
, or the setup instructions).
We use Postgres around these parts. Installation will differ based on your OS.
-
Install Postgres
- MacOS:
brew install postgres
- Ubuntu: install
postgresql
,libpq-dev
, andpostgresql-client
- Other linux instructions (server and developer libraries needed)
- Set the daemon to run automatically, if needed
- MacOS:
-
Configure Postgres
- Setup your user; the suggested password is
postgres
if you only use this machine for development purposessudo -u postgres createuser -P -s `whoami`
- Set your env variables:
echo "POSTGRES_USER=`whoami`" >>.env echo "POSTGRES_PASSWORD=postgres" >>.env
- Setup your user; the suggested password is
- Run the command
gem install bundler && bundle install
to install dependencies, includingrails
. - Install JS packages:
yarn install
- Run the command
rails db:create db:migrate db:seed
to set up the database and populate it with some test data.
- Run the command
bin/dev
to start the rails server - You are officially ready to go! Navigate your browser to
http://localhost:3000
. You can log in with the user[email protected]
and the passwordAbortionsAreAHumanRight1
.