From 7d3fb19594ef170e10c6f23d93bbe2bf2d7959f1 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 5 Nov 2015 02:41:08 +0300 Subject: [PATCH] Updated a config files for integration with docker --- config/application.yml.sample | 70 ++++++++++++++++------------------- config/database.yml.sample | 13 ++++--- config/initializers/redis.rb | 5 ++- config/puma/production.rb | 7 ---- 4 files changed, 41 insertions(+), 54 deletions(-) diff --git a/config/application.yml.sample b/config/application.yml.sample index 8e74406a3..e1f632ea0 100644 --- a/config/application.yml.sample +++ b/config/application.yml.sample @@ -3,34 +3,34 @@ common: &common repo_project_name: ABF anonymous_access: true preregistration: false - file_store_url: 'http://file-store.rosalinux.ru' + file_store_url: <%= ENV["FILE_STORE_URL"] %> distr_types: ['mdv', 'rhel', 'nau5'] allowed_addresses: - - 127.0.0.100 + - 127.0.0.1 abf_worker: - publish_workers_count: 2 + publish_workers_count: <%= ENV["ABF_WORKER_PUBLISH_WORKERS_COUNT"] %> log_server: - host: 127.0.0.1 - port: 6379 + host: <%= ENV["ABF_WORKER_LOG_SERVER_HOST"] %> + port: <%= ENV["ABF_WORKER_LOG_SERVER_PORT"] %> keys: - key_pair_secret_key: 'key_pair_secret_key' - node_instruction_secret_key: 'node_instruction_secret_key' - airbrake_api_key: 'airbrake_api_key' - secret_token: 'secret_token' - secret_key_base: 'secret_key_base' + key_pair_secret_key: <%= ENV["KEY_PAIR_SECRET_KEY"] %> + node_instruction_secret_key: <%= ENV["NODE_INSTRUCTION_SECRET_KEY"] %> + airbrake_api_key: <%= ENV["AIRBRAKE_API_KEY"] %> + secret_token: <%= ENV["SECRET_TOKEN"] %> + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> devise: - pepper: 'devise_pepper' - secret: 'devise_secret' + pepper: <%= ENV["DEVISE_PEPPER"] %> + secret: <%= ENV["DEVISE_SECRET"] %> github: - id: 'APP_ID' - secret: 'APP_SECRET' + id: <%= ENV["GITHUB_APP_ID"] %> + secret: <%= ENV["GITHUB_APP_SECRET"] %> google: - id: 'APP_ID' - secret: 'APP_SECRET' + id: <%= ENV["GOOGLE_APP_ID"] %> + secret: <%= ENV["GOOGLE_APP_SECRET"] %> facebook: - id: 'APP_ID' - secret: 'APP_SECRET' - downloads_url: 'http://abf-downloads.rosalinux.ru' + id: <%= ENV["FACEBOOK_APP_ID"] %> + secret: <%= ENV["FACEBOOK_APP_SECRET"] %> + downloads_url: <%= ENV["DOWNLOADS_URL"] %> wiki_formats: markdown: "Markdown" textile: "Textile" @@ -40,20 +40,12 @@ common: &common # mediawiki: "MediaWiki" feedback: email: - - 'test@example.com' - - 'test1@example.com' - # or - # email: 'test@example.com' - - # optional parameters + - <%= ENV["FEEDBACK_EMAIL"] %> cc: - - 'test2@example.com' # or like email - bcc: - - 'test3@example.com' # or like email - subject_prefixes: # or one line - - 'from_feedback' - subject_postfixes: # or one line - - 'sample_postfix' + - <%= ENV["FEEDBACK_CC"] %> + subject_prefixes: + - 'abf-users' + - 'feeback_form' shell_user: 'git' development: @@ -68,14 +60,14 @@ development: production: <<: *common - root_path: /share - git_path: /mnt/gitstore - tmpfs_path: /dev/shm - do-not-reply-email: do-not-reply@abf.rosalinux.ru - mailer_https_url: false + root_path: <%= ENV["ROOT_PATH"] %> + git_path: <%= ENV["GIT_PATH"] %> + tmpfs_path: <%= ENV["TMPFS_PATH"] %> + do-not-reply-email: <%= ENV["DO_NOT_REPLY_EMAIL"] %> + mailer_https_url: <%= ENV["MAILER_HTTPS_URL"] %> github_services: - ip: 127.0.0.1 - port: 1234 + ip: <%= ENV["GITHUB_SERVICES_ID"] %> + port: <%= ENV["GITHUB_SERVICES_PORT"] %> test: <<: *common diff --git a/config/database.yml.sample b/config/database.yml.sample index d6ed8c302..26ecb0ed9 100644 --- a/config/database.yml.sample +++ b/config/database.yml.sample @@ -1,16 +1,17 @@ production: adapter: postgresql encoding: unicode - database: rosa_build + database: <%= ENV["DATABASE_NAME"] %> template: template0 - pool: 5 - username: rosa - password: rosa - host: localhost + host: <%= ENV["DATABASE_HOST"] %> + username: <%= ENV["DATABASE_USERNAME"] %> + password: <%= ENV["DATABASE_PASSWORD"] %> + pool: <%= ENV["DATABASE_POOL"] %> + timeout: <%= ENV["DATABASE_TIMEOUT"] %> test: adapter: postgresql encoding: unicode template: template0 database: rosa_build_test - username: postgres \ No newline at end of file + username: postgres diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb index dc5b4736c..848b630a2 100644 --- a/config/initializers/redis.rb +++ b/config/initializers/redis.rb @@ -1,6 +1,7 @@ class Redis def self.connect! - opts = { url: "redis://localhost:6379/#{::Rails.env.test? ? 1 : 0}" } + url = ENV["REDIS_URL"].presence || "redis://localhost:6379/#{::Rails.env.test? ? 1 : 0}" + opts = { url: url } opts[:logger] = ::Rails.logger if ::Rails.application.config.log_redis @@ -8,4 +9,4 @@ class Redis end end -Redis.connect! \ No newline at end of file +Redis.connect! diff --git a/config/puma/production.rb b/config/puma/production.rb index 5c20b1688..cd1529e9a 100644 --- a/config/puma/production.rb +++ b/config/puma/production.rb @@ -1,8 +1,3 @@ -base_path = "/srv/rosa_build" -pidfile File.join(base_path, 'shared', 'pids', 'unicorn.pid') -state_path File.join(base_path, 'shared', 'pids', 'puma.state') -bind 'unix:///tmp/rosa_build_unicorn.sock' - environment ENV['RAILS_ENV'] || 'production' threads *(ENV['PUMA_THREADS'] || '16,16').split(',') workers ENV['PUMA_WORKERS'] || 7 @@ -30,5 +25,3 @@ on_worker_boot do Redis.connect! Rails.logger.info('Connected to Redis') end - -activate_control_app 'unix:///tmp/rosa_build_pumactl.sock'