Allow running specs in Docker container, update README #177
46
README.md
46
README.md
|
@ -14,8 +14,10 @@ so:
|
|||
|
||||
1. Make sure [Docker Compose is installed][1] and Docker is running (included in
|
||||
Docker Desktop)
|
||||
3. Run `docker compose up` and wait until 389ds announces its successful start
|
||||
in the log output
|
||||
3. Run `docker compose up --build` and wait until all services have started
|
||||
(389ds might take an extra minute to be ready). This will take a while when
|
||||
running for the first time, so you might want to do something else in the
|
||||
meantime.
|
||||
4. `docker-compose exec ldap dsconf localhost backend create --suffix="dc=kosmos,dc=org" --be-name="dev"`
|
||||
5. `docker compose run web rails ldap:setup`
|
||||
6. `docker compose run web rails db:setup`
|
||||
|
@ -28,38 +30,44 @@ have the password "user is user".
|
|||
|
||||
### Rails app
|
||||
|
||||
_Note: when using Docker Compose, prefix the following commands with `docker-compose
|
||||
run web`._
|
||||
|
||||
Installing dependencies:
|
||||
|
||||
bundle install
|
||||
yarn install
|
||||
|
||||
Setting up local database (SQLite):
|
||||
Migrating the local database (after schema changes):
|
||||
|
||||
bundle exec rails db:create
|
||||
bundle exec rails db:migrate
|
||||
|
||||
Running the dev server and auto-building CSS files on change:
|
||||
Running the dev server, and auto-building CSS files on change _(automatic with Docker Compose)_:
|
||||
|
||||
bin/dev
|
||||
|
||||
Running the background workers (requires Redis):
|
||||
Running the background workers (requires Redis) _(automatic with Docker Compose)_:
|
||||
|
||||
bundle exec sidekiq -C config/sidekiq.yml
|
||||
|
||||
Running all specs:
|
||||
Running the test suite:
|
||||
|
||||
bundle exec rspec
|
||||
|
||||
### Docker (Compose)
|
||||
Running the test suite with Docker Compose requires overriding the Rails
|
||||
environment:
|
||||
|
||||
There is a working Docker Compose config file, which define a number of services including
|
||||
an app server for Rails as well as a local 389ds (LDAP) server.
|
||||
docker-compose run -e "RAILS_ENV=test" web rspec
|
||||
|
||||
For Rails developers, you probably just want to start the LDAP server: `docker-compose up ldap`,
|
||||
listening on port 389 on your machine.
|
||||
### Docker Compose
|
||||
|
||||
You can pick and choose your services adding them by name (listed in `docker-compose.yml`) at
|
||||
the end of the docker compose command. eg. `docker compose up ldap redis`
|
||||
Services/containers are configured in `docker-compose.yml`.
|
||||
|
||||
You can run services selectively, for example if you want to run the Rails app
|
||||
and test suite on the host machine. Just add the service names of the
|
||||
containers you want to run to the `up` command, like so:
|
||||
|
||||
docker-compose up ldap redis
|
||||
|
||||
#### LDAP server
|
||||
|
||||
|
@ -76,13 +84,15 @@ Now you can seed the back-end with data using this Rails task:
|
|||
The setup task will first delete any existing entries in the directory tree
|
||||
("dc=kosmos,dc=org"), and then create our development entries.
|
||||
|
||||
Note that all 389ds data is stored in `tmp/389ds`. So if you want to start over
|
||||
with a fresh installation, delete both that directory as well as the container.
|
||||
Note that all 389ds data is stored in the `389ds-data` volume. So if you want
|
||||
to start over with a fresh installation, delete both that volume as well as the
|
||||
container.
|
||||
|
||||
#### Minio / RS
|
||||
#### Minio / remoteStorage
|
||||
|
||||
If you want to run remoteStorage accounts locally, you will have to create the
|
||||
respective bucket first:
|
||||
respective bucket first. With the `minio` container running (run by default
|
||||
when using Docker Compose), follow these steps:
|
||||
|
||||
* `docker compose up web redis minio liquor-cabinet`
|
||||
* Head to http://localhost:9001 and log in with user `minioadmin`, password
|
||||
|
|
|
@ -52,10 +52,9 @@ Rails.application.configure do
|
|||
|
||||
config.active_job.queue_adapter = :test
|
||||
|
||||
if ENV["S3_ENABLED"]
|
||||
if ENV["S3_ENABLED"] && ENV["S3_ENABLED"].to_s != "false"
|
||||
config.active_storage.service = :s3
|
||||
else
|
||||
# Store attachments on the local disk (in ./tmp)
|
||||
config.active_storage.service = :test
|
||||
config.active_storage.service = :local
|
||||
end
|
||||
end
|
||||
|
|
11
db/schema.rb
11
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_02_07_080515) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_02_16_124640) do
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "record_type", null: false
|
||||
|
@ -50,12 +50,17 @@ ActiveRecord::Schema[7.1].define(version: 2024_02_07_080515) do
|
|||
create_table "donations", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "amount_sats"
|
||||
t.integer "amount_eur"
|
||||
t.integer "amount_usd"
|
||||
t.integer "fiat_amount"
|
||||
t.string "public_name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "paid_at", precision: nil
|
||||
t.string "fiat_currency", default: "USD"
|
||||
t.string "donation_method"
|
||||
t.string "payment_method"
|
||||
t.string "btcpay_invoice_id"
|
||||
t.string "payment_status"
|
||||
t.index ["payment_status"], name: "index_donations_on_payment_status"
|
||||
t.index ["user_id"], name: "index_donations_on_user_id"
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe "WebFinger", type: :request do
|
|||
res = JSON.parse(response.body)
|
||||
rs_link = res["links"].find {|l| l["rel"] == "http://tools.ietf.org/id/draft-dejong-remotestorage"}
|
||||
|
||||
expect(rs_link["href"]).to eql("https://storage.kosmos.org/tony")
|
||||
expect(rs_link["href"]).to eql("#{Setting.rs_storage_url}/tony")
|
||||
|
||||
oauth_url = rs_link["properties"]["http://tools.ietf.org/html/rfc6749#section-4.2"]
|
||||
expect(oauth_url).to eql("http://www.example.com/rs/oauth/tony")
|
||||
|
|
Loading…
Reference in New Issue