From 500297dbe40f426473ea5ee61e9d86c48c609c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= Date: Sat, 1 Jun 2024 00:42:23 +0200 Subject: [PATCH] Split TSDB sample config, rename in compose and push initial downloads schema. --- config/database.yml.sample | 36 ++++----------------- config/database.yml.ts-sample | 60 +++++++++++++++++++++++++++++++++++ db/downloads_schema.rb | 29 +++++++++++++++++ docker-compose.yml | 6 ++-- 4 files changed, 98 insertions(+), 33 deletions(-) create mode 100644 config/database.yml.ts-sample create mode 100644 db/downloads_schema.rb diff --git a/config/database.yml.sample b/config/database.yml.sample index 632007fb383..9389ad3e71a 100644 --- a/config/database.yml.sample +++ b/config/database.yml.sample @@ -4,14 +4,6 @@ default: &default username: postgres prepared_statements: false -timescale: ×cale - adapter: postgresql - encoding: utf8 - username: postgres - password: devpassword - migrations_paths: db/downloads_migrate - port: 5434 - development: primary: <<: *default @@ -20,12 +12,7 @@ development: password: devpassword pool: 5 timeout: 5000 - downloads: - <<: *timescale - database: rubygems_tsdb_development - host: localhost - pool: 5 - timeout: 5000 + test: primary: @@ -36,13 +23,6 @@ test: password: testpassword pool: 5 timeout: 5000 - downloads: - <<: *timescale - database: rubygems_tsdb_test - host: localhost - min_messages: warning - pool: 5 - timeout: 5000 oidc-api-token: primary: @@ -51,9 +31,11 @@ oidc-api-token: min_messages: error pool: 30 reconnect: true - downloads: - <<: *timescale - database: rubygems_tsdb_staging + +staging: + primary: + <<: *default + database: rubygems_staging min_messages: error pool: 30 reconnect: true @@ -65,9 +47,3 @@ production: min_messages: error pool: 30 reconnect: true - downloads: - <<: *timescale - database: rubygems_tsdb_production - min_messages: error - pool: 30 - reconnect: true diff --git a/config/database.yml.ts-sample b/config/database.yml.ts-sample new file mode 100644 index 00000000000..ceffad6f109 --- /dev/null +++ b/config/database.yml.ts-sample @@ -0,0 +1,60 @@ +default: &default + adapter: postgresql + encoding: utf8 + username: postgres + prepared_statements: false + +timescale: ×cale + adapter: postgresql + encoding: utf8 + username: postgres + migrations_paths: db/downloads_migrate + port: 5434 + +development: + primary: + <<: *default + database: rubygems_development + host: localhost + password: devpassword + pool: 5 + timeout: 5000 + downloads: + <<: *timescale + database: rubygems_tsdb_development + host: localhost + password: devpassword + pool: 5 + timeout: 5000 + +test: + primary: + <<: *default + database: rubygems_test + host: localhost + min_messages: warning + password: testpassword + pool: 5 + timeout: 5000 + downloads: + <<: *timescale + database: rubygems_tsdb_test + host: localhost + min_messages: warning + password: testpassword + pool: 5 + timeout: 5000 + +production: + primary: + <<: *default + database: rubygems_production + min_messages: error + pool: 30 + reconnect: true + downloads: + <<: *timescale + database: rubygems_tsdb_production + min_messages: error + pool: 30 + reconnect: true diff --git a/db/downloads_schema.rb b/db/downloads_schema.rb new file mode 100644 index 00000000000..c671806b287 --- /dev/null +++ b/db/downloads_schema.rb @@ -0,0 +1,29 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema[7.1].define(version: 0) do + create_schema "_timescaledb_cache" + create_schema "_timescaledb_catalog" + create_schema "_timescaledb_config" + create_schema "_timescaledb_debug" + create_schema "_timescaledb_functions" + create_schema "_timescaledb_internal" + create_schema "timescaledb_experimental" + create_schema "timescaledb_information" + create_schema "toolkit_experimental" + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + enable_extension "timescaledb" + enable_extension "timescaledb_toolkit" + +end diff --git a/docker-compose.yml b/docker-compose.yml index 5e18a3cd944..6806e58d0a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,15 +2,15 @@ services: db: image: postgres:13.14 environment: - POSTGRES_PASSWORD: devpassword + - POSTGRES_HOST_AUTH_METHOD=trust ports: - "5432:5432" - timescale: + db-ts: image: timescale/timescaledb-ha:pg16.2-ts2.14.2-all ports: - "5434:5432" environment: - POSTGRES_PASSWORD: devpassword + - POSTGRES_HOST_AUTH_METHOD=trust cache: image: memcached:1.4.39 ports: