Merge pull request #3039 from Pegasus-RPG/patch-1

Update bundle config command, add instructions for PostgreSQL
This commit is contained in:
Jyri-Petteri Paloposki 2024-07-19 14:05:48 +03:00 committed by GitHub
commit e1c5fbbbc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 67 additions and 67 deletions

View file

@ -41,13 +41,13 @@ EXPOSE 3000
CMD ["./bin/rails", "server", "-b", "0.0.0.0"] CMD ["./bin/rails", "server", "-b", "0.0.0.0"]
FROM base AS precompile FROM base AS precompile
RUN bundle config set with assets
RUN bundle config set deployment true RUN bundle config set deployment true
RUN bundle install --jobs 4 RUN bundle install --jobs 4
RUN RAILS_GROUPS=assets bundle exec rake assets:precompile RUN RAILS_GROUPS=assets bundle exec rake assets:precompile
# Build the environment-specific stuff # Build the environment-specific stuff
FROM base AS production FROM base AS production
RUN bundle config set without assets
RUN bundle config --global frozen 1 RUN bundle config --global frozen 1
RUN bundle install --jobs 4 RUN bundle install --jobs 4
COPY --from=precompile /app/public/assets /app/public/assets COPY --from=precompile /app/public/assets /app/public/assets
@ -56,10 +56,11 @@ FROM base AS test
COPY test /app/test/ COPY test /app/test/
# For testing the API client # For testing the API client
COPY doc /app/doc/ COPY doc /app/doc/
RUN bundle config set with development test assets RUN bundle config set without assets
RUN bundle config set with development test
RUN bundle config --global frozen 1 RUN bundle config --global frozen 1
RUN bundle install --jobs 4 RUN bundle install --jobs 4
RUN RAILS_GROUPS=assets bundle exec rake assets:precompile COPY --from=precompile /app/public/assets /app/public/assets
FROM base AS development FROM base AS development
RUN bundle config set with development test RUN bundle config set with development test

22
Gemfile
View file

@ -3,19 +3,11 @@ source 'https://rubygems.org'
gem 'actionpack-xml_parser', '~> 2.0' gem 'actionpack-xml_parser', '~> 2.0'
gem 'activemodel-serializers-xml', '~> 1.0.1' gem 'activemodel-serializers-xml', '~> 1.0.1'
gem 'coffee-rails', '~> 5.0.0' gem 'rails', '~> 6.1'
gem 'font-awesome-sass', '~> 6.5.2'
gem 'jquery-rails', '~> 4.6' gem 'jquery-rails', '~> 4.6'
gem 'jquery-ui-rails', '~>7.0.0' gem 'jquery-ui-rails', '~>7.0.0'
gem 'rails', '~> 6.1'
gem 'sassc-rails', '~> 2.1.2'
gem 'bootstrap-sass', '3.4.1'
gem 'font-awesome-sass', '~> 6.5.2'
gem 'uglifier', '>=1.3.0'
gem 'aasm', '~> 5.5.0' gem 'aasm', '~> 5.5.0'
gem 'acts_as_list' gem 'acts_as_list'
gem 'bcrypt', '~> 3.1.20' gem 'bcrypt', '~> 3.1.20'
@ -33,7 +25,14 @@ gem 'sqlite3', '~> 1.4', group: :sqlite
gem 'mysql2', '~> 0.5', group: :mysql gem 'mysql2', '~> 0.5', group: :mysql
gem 'pg', '~> 1.1', group: :postgresql gem 'pg', '~> 1.1', group: :postgresql
group :assets, :optional => true do # See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'mini_racer', group: :therubyracer
group :assets do
gem 'coffee-rails', '~> 5.0.0'
gem 'sassc-rails', '~> 2.1.2'
gem 'bootstrap-sass', '3.4.1'
gem 'uglifier', '>=1.3.0'
gem 'listen' gem 'listen'
gem 'tolk', '~> 5.0.1' gem 'tolk', '~> 5.0.1'
end end
@ -52,7 +51,6 @@ end
group :development, :test, :optional => true do group :development, :test, :optional => true do
gem 'byebug' gem 'byebug'
gem 'rubocop', '~> 1.65' gem 'rubocop', '~> 1.65'
gem 'mini_racer'
end end
group :test, :optional => true do group :test, :optional => true do

View file

@ -2,30 +2,33 @@
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your # This file is the source Rails uses to define your schema when running `bin/rails
# database schema. If you need to create the application database on another # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# system, you should be using db:schema:load, not running all the migrations # be faster and is potentially less error prone than running all of your
# from scratch. The latter is a flawed and unsustainable approach (the more migrations # migrations from scratch. Old migrations may fail to apply correctly if those
# you'll amass, the slower it'll run and the greater likelihood for issues). # migrations use external dependencies or application code.
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_08_20_000743) do ActiveRecord::Schema.define(version: 2020_08_20_000743) do
create_table "attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| # These are extensions that must be enabled in order to support this database
t.integer "todo_id" enable_extension "plpgsql"
create_table "attachments", force: :cascade do |t|
t.bigint "todo_id"
t.string "file_file_name" t.string "file_file_name"
t.string "file_content_type" t.string "file_content_type"
t.integer "file_file_size" t.bigint "file_file_size"
t.datetime "file_updated_at" t.datetime "file_updated_at"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.index ["todo_id"], name: "index_attachments_on_todo_id" t.index ["todo_id"], name: "index_attachments_on_todo_id"
end end
create_table "contexts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "contexts", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.integer "position", default: 0 t.integer "position"
t.integer "user_id", default: 1 t.integer "user_id", default: 1
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -34,7 +37,7 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["user_id"], name: "index_contexts_on_user_id" t.index ["user_id"], name: "index_contexts_on_user_id"
end end
create_table "dependencies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "dependencies", force: :cascade do |t|
t.integer "successor_id", null: false t.integer "successor_id", null: false
t.integer "predecessor_id", null: false t.integer "predecessor_id", null: false
t.string "relationship_type" t.string "relationship_type"
@ -42,7 +45,7 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["successor_id"], name: "index_dependencies_on_successor_id" t.index ["successor_id"], name: "index_dependencies_on_successor_id"
end end
create_table "notes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "notes", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false
t.integer "project_id", null: false t.integer "project_id", null: false
t.text "body" t.text "body"
@ -52,7 +55,7 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["user_id"], name: "index_notes_on_user_id" t.index ["user_id"], name: "index_notes_on_user_id"
end end
create_table "open_id_authentication_associations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "open_id_authentication_associations", force: :cascade do |t|
t.integer "issued" t.integer "issued"
t.integer "lifetime" t.integer "lifetime"
t.string "handle" t.string "handle"
@ -61,13 +64,13 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.binary "secret" t.binary "secret"
end end
create_table "open_id_authentication_nonces", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "open_id_authentication_nonces", force: :cascade do |t|
t.integer "timestamp", null: false t.integer "timestamp", null: false
t.string "server_url" t.string "server_url"
t.string "salt", null: false t.string "salt", null: false
end end
create_table "preferences", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "preferences", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false
t.string "date_format", limit: 40, default: "%d/%m/%Y", null: false t.string "date_format", limit: 40, default: "%d/%m/%Y", null: false
t.integer "week_starts", default: 0, null: false t.integer "week_starts", default: 0, null: false
@ -79,9 +82,9 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.integer "refresh", default: 0, null: false t.integer "refresh", default: 0, null: false
t.boolean "verbose_action_descriptors", default: false, null: false t.boolean "verbose_action_descriptors", default: false, null: false
t.boolean "show_hidden_projects_in_sidebar", default: true, null: false t.boolean "show_hidden_projects_in_sidebar", default: true, null: false
t.string "time_zone", default: "London", null: false t.string "time_zone", limit: 255, default: "London", null: false
t.boolean "show_project_on_todo_done", default: false, null: false t.boolean "show_project_on_todo_done", default: false, null: false
t.string "title_date_format", default: "%A, %d %B %Y", null: false t.string "title_date_format", limit: 255, default: "%A, %d %B %Y", null: false
t.integer "mobile_todos_per_page", default: 6, null: false t.integer "mobile_todos_per_page", default: 6, null: false
t.string "sms_email" t.string "sms_email"
t.integer "sms_context_id" t.integer "sms_context_id"
@ -91,11 +94,11 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["user_id"], name: "index_preferences_on_user_id" t.index ["user_id"], name: "index_preferences_on_user_id"
end end
create_table "projects", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "projects", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.integer "position", default: 0 t.integer "position"
t.integer "user_id", default: 1 t.integer "user_id", default: 1
t.text "description", limit: 16777215 t.text "description"
t.string "state", limit: 20, null: false t.string "state", limit: 20, null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -109,12 +112,12 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["user_id"], name: "index_projects_on_user_id" t.index ["user_id"], name: "index_projects_on_user_id"
end end
create_table "recurring_todos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "recurring_todos", force: :cascade do |t|
t.integer "user_id", default: 1 t.integer "user_id", default: 1
t.integer "context_id", null: false t.integer "context_id", null: false
t.integer "project_id" t.integer "project_id"
t.string "description", null: false t.string "description", null: false
t.text "notes", limit: 16777215 t.text "notes"
t.string "state", limit: 20, null: false t.string "state", limit: 20, null: false
t.datetime "start_from" t.datetime "start_from"
t.string "ends_on" t.string "ends_on"
@ -133,21 +136,21 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.integer "every_count" t.integer "every_count"
t.integer "weekday" t.integer "weekday"
t.datetime "completed_at" t.datetime "completed_at"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.boolean "show_always" t.boolean "show_always"
t.index ["state"], name: "index_recurring_todos_on_state" t.index ["state"], name: "index_recurring_todos_on_state"
t.index ["user_id"], name: "index_recurring_todos_on_user_id" t.index ["user_id"], name: "index_recurring_todos_on_user_id"
end end
create_table "sessions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "sessions", force: :cascade do |t|
t.string "session_id" t.string "session_id"
t.text "data" t.text "data"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["session_id"], name: "sessions_session_id_index" t.index ["session_id"], name: "index_sessions_on_session_id"
end end
create_table "taggings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "taggings", force: :cascade do |t|
t.integer "taggable_id" t.integer "taggable_id"
t.integer "tag_id" t.integer "tag_id"
t.string "taggable_type" t.string "taggable_type"
@ -156,7 +159,7 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["taggable_id", "taggable_type"], name: "index_taggings_on_taggable_id_and_taggable_type" t.index ["taggable_id", "taggable_type"], name: "index_taggings_on_taggable_id_and_taggable_type"
end end
create_table "tags", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "tags", force: :cascade do |t|
t.string "name" t.string "name"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -164,11 +167,11 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["name"], name: "index_tags_on_name" t.index ["name"], name: "index_tags_on_name"
end end
create_table "todos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "todos", force: :cascade do |t|
t.integer "context_id", null: false t.integer "context_id", null: false
t.integer "project_id" t.integer "project_id"
t.text "description", null: false t.text "description", null: false
t.text "notes", limit: 16777215 t.text "notes"
t.datetime "created_at" t.datetime "created_at"
t.datetime "due" t.datetime "due"
t.datetime "completed_at" t.datetime "completed_at"
@ -177,7 +180,6 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.string "state", limit: 20, null: false t.string "state", limit: 20, null: false
t.integer "recurring_todo_id" t.integer "recurring_todo_id"
t.datetime "updated_at" t.datetime "updated_at"
t.text "rendered_notes", limit: 16777215
t.index ["context_id"], name: "index_todos_on_context_id" t.index ["context_id"], name: "index_todos_on_context_id"
t.index ["project_id"], name: "index_todos_on_project_id" t.index ["project_id"], name: "index_todos_on_project_id"
t.index ["state"], name: "index_todos_on_state" t.index ["state"], name: "index_todos_on_state"
@ -186,20 +188,20 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["user_id", "state"], name: "index_todos_on_user_id_and_state" t.index ["user_id", "state"], name: "index_todos_on_user_id_and_state"
end end
create_table "tolk_locales", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "tolk_locales", force: :cascade do |t|
t.string "name" t.string "name"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["name"], name: "index_tolk_locales_on_name", unique: true t.index ["name"], name: "index_tolk_locales_on_name", unique: true
end end
create_table "tolk_phrases", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "tolk_phrases", force: :cascade do |t|
t.text "key" t.text "key"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
create_table "tolk_translations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "tolk_translations", force: :cascade do |t|
t.integer "phrase_id" t.integer "phrase_id"
t.integer "locale_id" t.integer "locale_id"
t.text "text" t.text "text"
@ -210,9 +212,9 @@ ActiveRecord::Schema.define(version: 2020_08_20_000743) do
t.index ["phrase_id", "locale_id"], name: "index_tolk_translations_on_phrase_id_and_locale_id", unique: true t.index ["phrase_id", "locale_id"], name: "index_tolk_translations_on_phrase_id_and_locale_id", unique: true
end end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string "login", limit: 80, null: false t.string "login", limit: 80, null: false
t.string "crypted_password", limit: 60 t.string "crypted_password", limit: 60, null: false
t.string "token" t.string "token"
t.boolean "is_admin", default: false, null: false t.boolean "is_admin", default: false, null: false
t.string "first_name" t.string "first_name"

View file

@ -44,7 +44,7 @@ Tracks container. In future there should be an official image in Docker Hub. You
1. Get the Tracks code base by either downloading the archive file for the latest releast or cloning it from GitHub. 1. Get the Tracks code base by either downloading the archive file for the latest releast or cloning it from GitHub.
2. Run the following command in the Tracks directory to build the image: 2. Run the following command in the Tracks directory to build the image:
``` ```
$ docker build -t="tracks" . $ docker build -t="tracks" --target=production .
``` ```
1. Make sure you have Docker properly installed. 1. Make sure you have Docker properly installed.
@ -153,13 +153,22 @@ Tracks is built upon a number of Ruby libraries (known as gems). The Bundl
* If you are using SQLite: * If you are using SQLite:
``` ```
bundle install --without "development test mysql" bundle config set without mysql postgresql
bundle install
``` ```
* If you are using MySQL: * If you are using MySQL:
``` ```
bundle install --without "development test sqlite" bundle config set without sqlite postgresql
bundle install
```
* If you are using PostgreSQL:
```
bundle config set without sqlite mysql
bundle install
``` ```
* If you are installing Tracks on Windows or Mac OS X, or if you have another JavaScript runtime such as Node.js installed, you may also append `therubyracer` as an additional "without" parameter. * If you are installing Tracks on Windows or Mac OS X, or if you have another JavaScript runtime such as Node.js installed, you may also append `therubyracer` as an additional "without" parameter.

View file

@ -5,8 +5,6 @@ services:
environment: environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 1 MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_DATABASE: ${TRACKS_DB:-tracks} MYSQL_DATABASE: ${TRACKS_DB:-tracks}
volumes:
- db-data:/var/lib/mysql
web: web:
build: build:
context: .. context: ..
@ -20,12 +18,9 @@ services:
DATABASE_USERNAME: root DATABASE_USERNAME: root
DATABASE_PASSWORD_EMPTY: 1 DATABASE_PASSWORD_EMPTY: 1
volumes: volumes:
- ${VOLUME:-..}:/app:Z
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z - ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z - ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
ports: ports:
- 3000:3000 - 3000:3000
depends_on: depends_on:
- db - db
volumes:
db-data:

View file

@ -5,8 +5,6 @@ services:
environment: environment:
POSTGRES_DB: ${DATABASE_NAME:-tracks} POSTGRES_DB: ${DATABASE_NAME:-tracks}
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
volumes:
- db-data:/var/lib/postgresql/data
web: web:
build: build:
context: .. context: ..
@ -23,12 +21,9 @@ services:
DATABASE_ENCODING: unicode DATABASE_ENCODING: unicode
DATABASE_PORT: 5432 DATABASE_PORT: 5432
volumes: volumes:
- ${VOLUME:-..}:/app:Z
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z - ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z - ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
ports: ports:
- 3000:3000 - 3000:3000
depends_on: depends_on:
- db - db
volumes:
db-data:

View file

@ -12,7 +12,7 @@ services:
DATABASE_NAME: "/app/db/db.sqlite" DATABASE_NAME: "/app/db/db.sqlite"
DATABASE_TYPE: sqlite3 DATABASE_TYPE: sqlite3
volumes: volumes:
- ${VOLUME:-sqlite}:/app/db:Z - sqlite:/app/db:Z
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z - ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z - ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
ports: ports: