Skip to content

Commit

Permalink
Update README.md and fix setup to work with or without docker
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryrck committed Sep 29, 2024
1 parent 9f1093a commit 4376629
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
53 changes: 48 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Keeps track of membership to a society.

## Getting started

(Docker version follows).

### Prerequisites

* Ruby (See `.ruby-version` for the version you have to install)
Expand All @@ -12,7 +14,15 @@ Keeps track of membership to a society.

### Set-up

Clone this repository and run the following from the working directory:
Install dependencies, copy `config/database.yml.sample` to `config/database.yml`:

```
cp config/database.yml.sample config/database.yml
```

Edit `config/database.yml` according to your setup.

Then run:

bin/setup
yarn install
Expand All @@ -31,14 +41,47 @@ And

yarn build --watch

## Testing

This codebase started out without tests. Some are being introduced over time.

To run tests:

bundle exec rspec

## Getting started (using docker)

Install [docker](https://docs.docker.com/engine/install/) and
[docker compose](https://docs.docker.com/compose/install/).

Copy files:

```
cp docker-compose.yml.sample docker-compose.yml
cp config/database.yml.docker config/database.yml
```

Edit them according to your setup.

NOTE: leave `RAILS_ENV: test` or change it to `RAILS_ENV: development` in
`docker-compose.yml`. Either value does the same.

Then run:

```
docker compose pull
docker compose build
docker compose run --rm app ./bin/setup
```

To start:

```
docker compose up app assets
```

To run the tests:

```
docker compose run --rm app bundle exec rspec
```

## Voting

Voting can be enabled by setting a `VOTE_URL_TEMPLATE` environment variable.
Expand Down
5 changes: 0 additions & 5 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ FileUtils.chdir APP_ROOT do
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")

puts "\n== Copying sample files =="
unless File.exist?("config/database.yml")
FileUtils.cp "config/database.yml.sample", "config/database.yml"
end

puts "\n== Preparing database =="
system! "bin/rails db:prepare"

Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
expose:
- "5432"

app:
assets: &ruby
build:
context: .
args:
Expand All @@ -23,6 +23,10 @@ services:
- AUTH_NAME=secretary
- AUTH_PASSWORD=password
working_dir: /app
command: yarn build --watch

app:
<<: *ruby
command: bundle exec falcon serve -n 2 -b 'http://0.0.0.0:3000'
ports:
- "3000:3000"
Expand Down

0 comments on commit 4376629

Please sign in to comment.