The Challenge.Gov Platform
- PostgreSQL 16+
- Ruby 3.2+
- Node.js 20.x
- Yarn 1.22.x
Install PostgreSQL according to your OS of choice, for MacOS Postgres.app is recommended.
Install of the languages needed can be done via ASDF or Nix
To install Ruby and NodeJS it is recommended to use the asdf version manager. Install instructions are copied here for MacOS, for other OSs see asdf docs. This also assumes you have HomeBrew installed.
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.0
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
brew install \
coreutils automake autoconf openssl \
libyaml readline libxslt libtool unixodbc
Once asdf is set up, install each language. NodeJS may require setting up keys, and should display help to guide you.
asdf plugin-add ruby
asdf install ruby 3.2.4
asdf plugin-add nodejs
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf install nodejs 20.15.1
asdf plugin-add yarn
asdf install yarn 1.22.22
Once on your machine, you need to install the nix package manager by following their multi-user installer. Once nix is installed, setup direnv by hooking into your shell. This only has to be done on your machine once.
nix-env -f '<nixpkgs>' -iA direnv
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
Once direnv is installed and your shell is restarted, clone the project and cd
into it. You should see direnv warn about an untrusted .envrc
file. Allow the file and finish installing dependencies and setting up the application.
- Allow direnv to use the envrc file
direnv allow
- Install rubygems dependencies with
bundle install
- Install nodejs dependencies
yarn install
- Set up your uswds files in the build directory
npx gulp copyAssets
- Setup the database
rake db:create
, note that postgres must be running for this to work - Boot the system, this will run the sass, esbuild, and uswds watchers along with the rails server
./bin/dev
NOTE for login.gov configuration -- if you are not using direnv/nix to eval
.envrc
, you can runsource .env_dev
in your terminal before starting the server or add the env vars in that file to your local environment directly.
Now you can visit localhost:3000
from your browser.