Compare commits

..

11 commits

Author SHA1 Message Date
1resu c3ae113a38 Update Readme 2021-12-21 08:45:42 +01:00
1resu 604de8118f Use puma in favour of webrick 2021-12-21 08:45:42 +01:00
JuliusR 9f3d301550 improve handling of User resource 2021-12-21 08:45:42 +01:00
JuliusR d705402d8b simplify routes 2021-12-21 08:45:42 +01:00
JuliusR dd6d35e3bd add unique index on Users#email 2021-12-21 08:45:42 +01:00
JuliusR e5a9c03eb9 rails db:schema:dump
This updates the db/schema.rb from a clean development database
(mariadb:10.1) using Rails 6.1.
2021-12-21 08:45:42 +01:00
JuliusR c2ee9065db add public/packs to .gitignore 2021-12-21 08:45:42 +01:00
JuliusR 0d88a64df9 stop ignoring config/*.yml, but ignore config/database.yml 2021-12-21 08:45:42 +01:00
JuliusR 16807381e5 copy .gitignore from old sharedlists 2021-12-21 08:45:42 +01:00
JuliusR b318469606 replace database.yml by database.yml.SAMPLE (now mysql2 only) 2021-12-21 08:45:41 +01:00
JuliusR 248d787ba5 fix GEM_PATH and PATH in Dockerfile.development 2021-12-21 08:45:41 +01:00
3 changed files with 17 additions and 15 deletions

View file

@ -9,6 +9,7 @@ gem 'webpacker', '~> 5.0'
gem 'turbolinks', '~> 5' gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7' gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.4.4', require: false gem 'bootsnap', '>= 1.4.4', require: false
gem 'puma', '~> 5.0'
group :development, :test do group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
@ -42,5 +43,3 @@ gem 'will_paginate', '~> 3.0'
gem 'whenever', '~> 0.9', require: false gem 'whenever', '~> 0.9', require: false
gem 'mysql2', '>=0.5' gem 'mysql2', '>=0.5'
gem 'base32' gem 'base32'
gem "webrick", "~> 1.7" # fallback for removed puma; not included in alpine

View file

@ -127,6 +127,8 @@ GEM
mini_portile2 (~> 2.6.1) mini_portile2 (~> 2.6.1)
racc (~> 1.4) racc (~> 1.4)
public_suffix (4.0.6) public_suffix (4.0.6)
puma (5.5.2)
nio4r (~> 2.0)
racc (1.6.0) racc (1.6.0)
rack (2.2.3) rack (2.2.3)
rack-mini-profiler (2.3.3) rack-mini-profiler (2.3.3)
@ -230,7 +232,6 @@ GEM
rack-proxy (>= 0.6.1) rack-proxy (>= 0.6.1)
railties (>= 5.2) railties (>= 5.2)
semantic_range (>= 2.3.0) semantic_range (>= 2.3.0)
webrick (1.7.0)
websocket-driver (0.7.5) websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
@ -255,6 +256,7 @@ DEPENDENCIES
listen (~> 3.3) listen (~> 3.3)
midi-smtp-server (~> 3.0) midi-smtp-server (~> 3.0)
mysql2 (>= 0.5) mysql2 (>= 0.5)
puma (~> 5.0)
rack-mini-profiler (~> 2.0) rack-mini-profiler (~> 2.0)
rails (~> 6.1.4, >= 6.1.4.4) rails (~> 6.1.4, >= 6.1.4.4)
roo roo
@ -269,7 +271,6 @@ DEPENDENCIES
web-console (>= 4.1.0) web-console (>= 4.1.0)
webdrivers webdrivers
webpacker (~> 5.0) webpacker (~> 5.0)
webrick (~> 1.7)
whenever (~> 0.9) whenever (~> 0.9)
will_paginate (~> 3.0) will_paginate (~> 3.0)

View file

@ -5,7 +5,7 @@
Sharedlists is a simple rails driven database for managing multiple product lists of various suppliers. Sharedlists is a simple rails driven database for managing multiple product lists of various suppliers.
This app is used in conjunction with [foodsoft](https://github.com/foodcoops/foodsoft). This app is used in conjunction with [foodsoft](https://github.com/foodcoops/foodsoft).
Recommended [Ruby](http://ruby-lang.org/) version is 2.3 (note that 2.4 does not work). Recommended [Ruby](http://ruby-lang.org/) version is 2.7.
## Development ## Development
@ -15,7 +15,7 @@ Recommended [Ruby](http://ruby-lang.org/) version is 2.3 (note that 2.4 does not
Copy `config/database.yml.SAMPLE` to `config/database.yml` and Copy `config/database.yml.SAMPLE` to `config/database.yml` and
docker-compose run --rm app bundle docker-compose run --rm app bundle
docker-compose run --rm app rake db:setup docker-compose run --rm app rails db:setup
### Run ### Run
@ -31,6 +31,8 @@ To access sharedlists, you'll need to create a user (and I guess you want admin
> u.save! > u.save!
> exit > exit
You can create more users within the web interface.
## Production ## Production
Either fetch the image, or build it: Either fetch the image, or build it:
@ -39,16 +41,16 @@ Either fetch the image, or build it:
# or # or
docker build --tag sharedlists:latest --rm . docker build --tag sharedlists:latest --rm .
Then set environment variables `SECRET_TOKEN` and `DATABASE_URL` and run: Then set environment variables `SECRET_KEY_BASE` and `DATABASE_URL` and run:
docker run --name sharedlists_web \ docker run --name sharedlists_web \
-e SECRET_TOKEN -e DATABASE_URL -e RAILS_FORCE_SSL=false \ -e SECRET_KEY_BASE -e DATABASE_URL -e RAILS_FORCE_SSL=false \
sharedlists:latest sharedlists:latest
To run cronjobs, start another instance: To run cronjobs, start another instance:
docker run --name sharedlists_cron \ docker run --name sharedlists_cron \
-e SECRET_TOKEN -e DATABASE_URL \ -e SECRET_KEY_BASE -e DATABASE_URL \
sharedlists:latest ./proc-start cron sharedlists:latest ./proc-start cron
If you want to process incoming mails, add another instance like the previous, If you want to process incoming mails, add another instance like the previous,
@ -97,19 +99,19 @@ Once you have the `sync_ftp_files` task working, you may wish to setup a
### Email ### Email
Some suppliers send a regular email with an article list in the attachment. For this, an Some suppliers send a regular email with an article list in the attachment. For this, an
email server needs to be run using the rake task `mail:smtp_server`. email server needs to be run using the rails task `mail:smtp_server`.
On production, you may want to run this on localhost on an unprivileged port, with a On production, you may want to run this on localhost on an unprivileged port, with a
proper [MTA](https://en.wikipedia.org/wiki/Message_transfer_agent) in front that proper [MTA](https://en.wikipedia.org/wiki/Message_transfer_agent) in front that
does message routing. does message routing.
To enable this for a certain supplier, tick the checkbox _Update articles by email_. Then To enable this for a certain supplier, tick the checkbox _Update articles by email_. Then
select a file format to use for importing, and the supplier's email address from which the select a file format to use for importing, and the supplier's email address from which the
email is sent. If you only want to import for mails with a subject that contains a certain email is sent. If you only want to import mails with a subject that contains a certain
text (e.g. _Articles in week_), fill in the subject field as well. text (e.g. _Articles in week_), fill in the subject field as well.
What email address does the supplier need to send to? Users will find this after saving What email address does the supplier need to send to? Users will find this after initial creating and
the supplier after _Send to_. saving the supplier after _Send to_.
This needs setting up of the environment variable `MAILER_DOMAIN`, on which you receive the This needs setting up of the environment variable `MAILER_DOMAIN`, on which you receive the
emails. It is allowed to prefix the address, you may want to set the prefix in `MAILER_PREFIX`. mails. It is allowed to prefix the address, you may want to set the prefix in `MAILER_PREFIX`.
This is useful when you're running an email server in front to route mails. This is useful when you're running a mail server in front to route mails.