Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Vagrantfile

package-lock.json
browsers.json
Brewfile.lock.json

saml_*.txt
saml_*.shr
Expand Down
6 changes: 6 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
brew 'postgresql@13'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somehow I was on postgres 14 (which I think is what matches prod right?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for trying it out, @zachmargolis ! 🎉 I'm glad it worked for you.

We are actually using postgres@13 in production. In the Slack thread regarding this ticket, it was mentioned that we may be moving to 14 in the coming months but are not there yet.

brew 'redis'
brew 'node@16'
brew 'yarn'
brew 'openssl@1.1'
cask 'chromedriver'
9 changes: 9 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,20 @@ Dir.chdir APP_ROOT do
run "cp pwned_passwords/pwned_passwords.txt.sample pwned_passwords/pwned_passwords.txt"

puts "\n== Installing dependencies =="
brew_installed = system "brew -v 2>&1"
run "brew bundle" if brew_installed
run "gem install bundler --conservative"
run 'gem install foreman --conservative && gem update foreman'
run "bundle check || bundle install --without deploy production"
run "yarn install"

puts "\n== Stopping running services to ensure clean start =="
run "brew services stop --all" if brew_installed

puts "\n== Starting services =="
run "brew services start redis" if brew_installed
run "brew services start postgresql@13" if brew_installed

puts "\n== Preparing database =="
run 'make clobber_db'

Expand Down
63 changes: 32 additions & 31 deletions docs/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,52 @@ This installation method is meant for those who are familiar with setting up loc
We recommend using [Homebrew](https://brew.sh/), [rbenv](https://github.com/rbenv/rbenv), [nvm](https://github.com/nvm-sh/nvm) or other version management tooling to install the below dependencies; while we don't anticipate changing these frequently, this will ensure that you will be able to easily switch to different versions as needed.

### Dependencies
1. To start, make sure you have the following dependencies installed and a working development environment:

- Ruby ~> 3.2.0
- [PostgreSQL](http://www.postgresql.org/download/)
- [Redis 7+](http://redis.io/)
- [Node.js v16](https://nodejs.org)
- [Yarn](https://yarnpkg.com/en/)
- [chromedriver](https://formulae.brew.sh/cask/chromedriver)
Installing the packages differs slightly if you're on a macOS or a different OS.

2. You will need to install openssl version 1.1:
If using macOS:

- Run `brew install openssl@1.1`
1. Install [rbenv](https://github.com/rbenv/rbenv) (lets you install and switch between different versions of Ruby)
1. Install Ruby. Choose the version [in the `.ruby-version` file](../.ruby-version)
1. Skip to the [set up local environment section](#set-up-local-environment). Your other dependencies will be installed in that step.

3. Test that you have Postgres and Redis running.
If not using macOS:

For example, if you've installed with Homebrew, you can start the services like this:
1. To start, make sure you have the following dependencies installed and a working development environment:

```
$ brew services start redis
$ brew services start postgresql
```
- [rbenv](https://github.com/rbenv/rbenv) (lets you install and switch between different versions of Ruby)
- Ruby. Choose the version [in the `.ruby-version` file](../.ruby-version)
- [PostgreSQL](http://www.postgresql.org/download/)
- [Redis 7+](http://redis.io/)
- [Node.js v16](https://nodejs.org)
- [Yarn](https://yarnpkg.com/en/)
- [chromedriver](https://formulae.brew.sh/cask/chromedriver)

To confirm the services are running properly, run:
```
$ brew services list
```
1. You will need to install openssl version 1.1:

4. Run the following command to set up your local environment:
- Run `brew install openssl@1.1`

```
$ make setup
```
1. Test that you have Postgres and Redis running.

This command copies sample configuration files, installs required gems
and sets up the database. Check out our Makefile commands to learn more about what this command does: https://github.com/18F/identity-idp/blob/main/Makefile
1. Continue to the [set up local environment section](#set-up-local-environment).

Note: If you didn't explicitly install `openssl@1.1` in Step 2 above and you use a M1 Mac, you may see an error on this step. Homebrew works differently on a M1 Mac, so specifying the version is necessary for the make script to work, but may still work on x86.
### Set up local environment

5. Now that you have you have everything installed, you can run the following command to start your local server:
1. Run the following command to set up your local environment:

```
$ make run
```
```
$ make setup
```

This command copies sample configuration files, installs required gems and brew packages (if using macOS), and sets up the database. Check out our [Makefile commands](../Makefile) to learn more about what this command does.

1. Now that you have you have everything installed, you can run the following command to start your local server:

```
$ make run
```

You should now be able to go to open up your favorite browser, go to `localhost:3000` and see your local development environment running.
You should now be able to go to open up your favorite browser, go to `localhost:3000` and see your local development environment running.

### Running tests locally

Expand Down