Add running and contributing instructions

This commit is contained in:
cryptogopher 2023-04-11 18:37:34 +02:00
parent 81d2d92924
commit d8c37d7a86
3 changed files with 88 additions and 3 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
/config/database.yml
/config/initializers/secret_token.rb
/config/master.key
/config/puma.rb
# Ignore all logfiles and tempfiles.
/log/*

View File

@ -6,6 +6,13 @@ Quantified self
* System dependencies: none
## Installation
git clone https://gitea.michalczyk.pro/fixin.me/fixin.me.git
bundle config set --local path '.gem'
bundle install
## Configuration
cp -a config/application.rb.dist config/application.rb
@ -15,7 +22,7 @@ Modify configuration settings below `SETUP` comment appropriately.
## Database
Create database user and grant privileges:
Grant database user and privileges:
> mysql -p
mysql> create user fixinme@localhost identified by '<some password>';
@ -33,7 +40,41 @@ Run database creation and migration tasks:
## Running
Apache configuration for: Puma+mod_proxy, mod_passenger ...
### Standalone Rails server + Apache proxy
Copy Puma config template:
cp -a config/puma.rb.dist config/puma.rb
and specify server IP/port, either with `port` or `bind`, e.g.:
bind 'tcp://0.0.0.0:3000'
Run server
RAILS_ENV="production" bin/rails s
## How to run the test suite: ...
### Apache mod_passenger
## Contributing
### Database
Grant database user privileges for development and test environments,
possibly with different Ruby versions:
> mysql -p
mysql> create user `fixinme-dev`@localhost identified by '<some password>';
mysql> grant all privileges on `fixinme-%`.* to `fixinme-dev`@localhost;
mysql> flush privileges;
### Environment
Use `RAILS_ENV="development"` for rake commands and running rails server.
Use `RAILS_ENV="test"` for running tests.

43
config/puma.rb.dist Normal file
View File

@ -0,0 +1,43 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart