Skip to content

Commit

Permalink
Describe how to run server
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Mar 16, 2019
1 parent a671ae1 commit 59b2dd0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# railsbench

Based on [headius/pgrailsbench](https://github.com/headius/pgrailsbench), but on Rails 5.2.
Based on [headius/pgrailsbench](https://github.com/headius/pgrailsbench),
but on Rails 5.2 and with database seeds.

## What's this?

Expand All @@ -27,14 +28,32 @@ sudo vi /etc/postgresql/10/main/pg_hba.conf
sudo systemctl restart postgresql
```

Create database and populate that.
Populate database and assets for `RAILS_ENV=production`.

```bash
bundle install
rails db:create db:migrate db:seed
RAILS_ENV=production rails db:create db:migrate db:seed
bundle exec rake db:create db:migrate db:seed RAILS_ENV=production
bundle exec rake assets:precompile RAILS_ENV=production
```

## Run

```bash
# CRuby
bundle exec puma -e production --workers=4 --threads=1 --preload

# JRuby
bundle exec puma -e production --threads=4
```

You can see posts on `localhost:3000/posts`.

Assets are not shown properly with `-e production` but it's intentional because
Rails assumes we delegate assets distribution to a reverse proxy on production by default.

If you want to see the actual apprecation behavior, do the setup with `RAILS_ENV=development`
and try `puma -e development`.

## License

MIT License
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit 59b2dd0

Please sign in to comment.