Skip to content

Commit d49e2de

Browse files
committed
Cleanup TS setup, add docs, ...
1 parent 500297d commit d49e2de

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AllCops:
1111
Exclude:
1212
- config/initializers/forbidden_yaml.rb
1313
- app/helpers/dynamic_errors_helper.rb
14-
- !ruby/regexp /(vendor|bundle|bin|db/(migrate/|schema\.rb)|tmp|server)($|\/.*)/
14+
- !ruby/regexp /(vendor|bundle|bin|db/(migrate/|schema\.rb|downloads_schema\.rb)|tmp|server)($|\/.*)/
1515
DisplayCopNames: true
1616
DisplayStyleGuide: true
1717
TargetRubyVersion: 3.3

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,20 @@ RSTUF_API_URL="http://localhost:80" bin/rails s
218218
When everything is set up, start the web server with `rails server` and browse to
219219
[localhost:3000](http://localhost:3000)!
220220
221+
#### Running with local Timescale
222+
223+
There is early and experimental [TimescaleDB](https://docs.timescale.com/self-hosted/latest/) support in RubyGems.org for downloads statistics. When secondary `downloads` database is configured (using `database.yml` or by providing `DOWNLOADS_DATABASE_URL` environment variable), experimental features are automatically enabled.
224+
225+
Localy, the easiest way is to run TimescaleDB using `docker-compose.yml` and configure using `database.yml.ts-sample`.
226+
227+
```bash
228+
cp config/database.yml.ts-sample config/database.yml
229+
docker compose up -d db cache search # run required dependencies
230+
docker compose up -d db-ts # run optional TimescaleDB dependency
231+
bin/rails db:setup # setup all databases, including optional Timescale one
232+
bin/rails s # start rails server as ususal
233+
```
234+
221235
Database Layout
222236
---------------
223237

script/build_docker.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,13 @@ docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache \
2626

2727
# This is a ruby script we run to ensure that all dependencies are configured properly in
2828
# the docker container, even if they are not used in the the few requests made to the application.
29-
docker run -e RAILS_ENV=production -e SECRET_KEY_BASE_DUMMY=1 \
30-
-e DOWNLOADS_DATABASE_URL=postgresql://localhost:5434 \
31-
-e DATABASE_URL=postgresql://localhost \
29+
docker run -e RAILS_ENV=production -e SECRET_KEY_BASE_DUMMY=1 -e DATABASE_URL=postgresql://localhost \
3230
--net host "$DOCKER_TAG" \
3331
-- bin/rails runner - <<-EOS
3432
Magic.buffer('')
3533
EOS
3634

37-
docker run -e RAILS_ENV=production -e SECRET_KEY_BASE_DUMMY=1 \
38-
-e DOWNLOADS_DATABASE_URL=postgresql://localhost:5434 \
39-
-e DATABASE_URL=postgresql://localhost \
35+
docker run -e RAILS_ENV=production -e SECRET_KEY_BASE_DUMMY=1 -e DATABASE_URL=postgresql://localhost \
4036
--net host "$DOCKER_TAG" \
4137
-- bin/rails db:create db:migrate
4238
docker run -d -e RAILS_ENV=production -e SECRET_KEY_BASE_DUMMY=1 -e DATABASE_URL=postgresql://localhost \

0 commit comments

Comments
 (0)