Skip to content

Instantly share code, notes, and snippets.

@heitortsergent
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save heitortsergent/4ee99be6c088a5c3034c to your computer and use it in GitHub Desktop.
Save heitortsergent/4ee99be6c088a5c3034c to your computer and use it in GitHub Desktop.
Feedbin Config
/**
* Documentation: http://docs.azk.io/Azkfile.js
*/
// Adds the systems that shape your system
systems({
feedbin: {
// Dependent systems
depends: ["clock", "worker-slow", "worker", "redis", "postgres", "elasticsearch", "memcached"],
// More images: http://images.azk.io
image: {"docker": "azukiapp/ruby:2.1.4"},
// Steps to execute before running instances
provision: [
"bundle install --path /azk/bundler",
],
workdir: "/azk/#{manifest.dir}",
shell: "/bin/bash",
command: "bundle exec rackup config.ru --pid /tmp/ruby.pid --port $HTTP_PORT --host 0.0.0.0",
wait: {"retry": 40, "timeout": 10000},
mounts: {
'/azk/#{manifest.dir}': path("."),
'/azk/bundler': persistent("bundler"),
},
scalable: {"default": 1},
http: {
domains: [ "#{system.name}.#{azk.default_domain}" ]
},
envs: {
// set instances variables
RUBY_ENV: "development",
BUNDLE_APP_CONFIG: "/azk/bundler",
},
},
worker: {
extends: 'feedbin',
provision: [
"bundle install --path /azk/bundler",
"bundle exec rake db:setup",
],
depends: ["postgres", "redis", "elasticsearch", "memcached"],
command: 'bundle exec sidekiq -c 12 -q critical,2 -q feed_refresher_receiver,1 -q default',
scalable: { limit: 1, default: 1},
http: null,
envs: {
DB_POOL: 12,
LIBRATO_AUTORUN: 1
}
},
"worker-slow": {
extends: 'feedbin',
depends: ["postgres", "redis", "elasticsearch", "memcached"],
command: 'bundle exec sidekiq -c 1 -q worker_slow_critical,3 -q worker_slow,2 -q favicon,1',
scalable: { default: 1, limit: 1 },
http: null,
envs: {
DB_POOL: 1
}
},
clock: {
extends: 'feedbin',
depends: ["postgres", "redis", "elasticsearch", "memcached"],
command: 'bundle exec clockwork lib/clock.rb',
scalable: { default: 1, limit: 1 },
http: null,
},
redis: {
image: {"docker": "redis"},
export_envs: {
"REDIS_HOST": "#{net.host}",
"REDIS_PORT": "#{net.port.data}",
"REDIS_URL": "redis://#{net.host}:#{net.port[6379]}",
},
},
postgres: {
// Dependent systems
depends: [],
// More images: http://images.azk.io
image: {"docker": "azukiapp/postgres:9.3"},
shell: "/bin/bash",
wait: {"retry": 20, "timeout": 1000},
mounts: {
'/var/lib/postgresql': persistent("postgresql"),
'/var/log/postgresql': path("./log/postgresql"),
},
ports: {
// exports global variables
data: "5432/tcp",
},
envs: {
POSTGRESQL_USER: "azk",
POSTGRESQL_PASS: "azk",
POSTGRESQL_DB: "postgres_development",
POSTGRESQL_HOST: "#{net.host}",
POSTGRESQL_PORT: "#{net.port.data}",
},
export_envs: {
// check this gist to configure your database
// https://gist.github.com/gullitmiranda/62082f2e47c364ef9617
POSTGRES_USERNAME: "azk",
POSTGRES_PASSWORD: "azk",
POSTGRES_DATABASE: "feedbin_development",
POSTGRES_HOST: "#{net.host}",
POSTGRES_PORT: "#{net.port.data}",
DATABASE_URL: "postgres://#{envs.POSTGRESQL_USER}:#{envs.POSTGRESQL_PASS}@#{net.host}:#{net.port.data}/${envs.POSTGRESQL_DB}",
},
},
elasticsearch: {
image: { "docker": "barnybug/elasticsearch:0.90.13" },
http: {
domains: [ "#{system.name}.#{azk.default_domain}" ]
},
ports: {
http: "9200",
},
export_envs : {
ELASTICSEARCH_URL: "#{system.name}.#{azk.default_domain}:#{net.port[9200]}",
},
},
memcached: {
image: { "docker": "memcached" },
ports: {
http: "11211",
},
export_envs: {
MEMCACHED_HOSTS: "#{system.name}.#{azk.default_domain}:#{net.port[11211]}"
}
}
});
development: &database
adapter: postgresql
encoding: unicode
database: <%= ENV['POSTGRES_DATABASE'] %>
pool: 19
username: <%= ENV['POSTGRES_USERNAME'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
host: <%= ENV['POSTGRES_HOST'] %>
port: <%= ENV['POSTGRES_PORT'] %>
test:
<<: *database
database: feedbin_test
#config/environments/development.rb
require 'silencer/logger'
Feedbin::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# config.action_controller.perform_caching = true
config.cache_store = :dalli_store, ENV['MEMCACHED_HOSTS'].split(',')
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
config.assets.debug = true
config.action_mailer.default_url_options = { host: 'feedbin.dev' }
# Log strong_parameters unpermitted
config.action_controller.action_on_unpermitted_parameters = :log
config.middleware.swap Rails::Rack::Logger, Silencer::Logger
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment