|
/** |
|
* Documentation: http://docs.azk.io/Azkfile.js |
|
*/ |
|
|
|
var ruby_system = function(command) { |
|
return { |
|
// Dependent systems |
|
depends: ["postgres", "mongodb", "redis", "mail"], |
|
// More images: http://images.azk.io |
|
image: "gullitmiranda/ruby", |
|
// Steps to execute before running instances |
|
provision: [ |
|
"bundle install --path /azk/bundler", |
|
"bundle exec rake db:create", |
|
"bundle exec rake db:migrate", |
|
], |
|
workdir: "/azk/#{manifest.dir}", |
|
command: "bundle exec " + command, |
|
shell: "/bin/bash", |
|
// not expect application response |
|
wait: false, |
|
// Mounts folders to assigned paths |
|
mount_folders: { |
|
'.': "/azk/#{manifest.dir}", |
|
// '../gems': "/www/gems" |
|
}, |
|
persistent_folders : [ "/azk/bundler" ], |
|
scalable: {"default": 1}, |
|
http: { |
|
// aircrm.azk.dev |
|
hostname: "#{system.name}.#{azk.default_domain}" |
|
}, |
|
envs: { |
|
// set instances variables |
|
RUBY_ENV: "development", |
|
RACK_ENV: "development", |
|
RAILS_ENV: "development", |
|
ENABLE_AZK: true, |
|
HOST: "#{system.name}.#{azk.default_domain}", |
|
|
|
MERCADOLIBRE_APP_ID: 5227026097385184, |
|
MERCADOLIBRE_APP_SECRET: "6PLlf1ybZP9RyM6jZYvxHpUDgejpEuP5", |
|
}, |
|
export_envs: { |
|
HTTP_PORT: "#{azk.default_domain}:#{net.port.http}", |
|
HTTPS_PORT: "#{azk.default_domain}:#{net.port.http}" |
|
} |
|
} |
|
} |
|
|
|
// Adds the systems that shape your system |
|
systems({ |
|
aircrm: ruby_system('rails server --port $HTTP_PORT --pid /tmp/rails.pid'), |
|
sidekiq: ruby_system('sidekiq'), |
|
|
|
mongodb: { |
|
scalable: false, |
|
ports: { |
|
http: "28017", |
|
}, |
|
http : { |
|
// aircrm-mongodb.azk.dev |
|
hostname: "#{manifest.dir}-#{system.name}.#{azk.default_domain}", |
|
}, |
|
persistent_folders : [ "/data/db" ], |
|
image : "dockerfile/mongodb", |
|
export_envs : { |
|
MONGODB_URI: "mongodb://#{net.host}:#{net.port[27017]}/aircrm_development", |
|
}, |
|
}, |
|
postgres: { |
|
scalable: false, |
|
image: "wyaeld/postgres:9.3", |
|
persistent_folders: [ "/var/lib/postgresql" ], |
|
ports: { |
|
data: "5432/tcp", |
|
}, |
|
envs: { |
|
// Move this to .env file |
|
POSTGRESQL_USER: "admin", |
|
POSTGRESQL_PASS: "oe9jaacZLbR9pN", |
|
POSTGRESQL_DB : "aircrm_development", |
|
POSTGRESQL_HOST: "#{net.host}", |
|
POSTGRESQL_PORT: "#{net.port.data}", |
|
}, |
|
|
|
export_envs: { |
|
DATABASE_URL: "postgres://#{envs.POSTGRESQL_USER}:#{envs.POSTGRESQL_PASS}@#{net.host}:#{net.port.data}/#{envs.POSTGRESQL_DB}", |
|
}, |
|
}, |
|
redis: { |
|
image: "dockerfile/redis", |
|
ports: { |
|
data: "6379/tcp", |
|
}, |
|
export_envs: { |
|
REDIS_URL: "redis://#{net.host}:#{net.port.data}/#{manifest.dir}" |
|
}, |
|
persistent_folders: [ "/data" ] |
|
}, |
|
mail: { |
|
image : "kdihalas/mail", |
|
scalable : { default: 1 }, |
|
http : { hostname : "#{manifest.dir}-#{system.name}.#{azk.default_domain}" }, |
|
ports : { |
|
smtp : "25:25/tcp", |
|
http : "1080/tcp" |
|
}, |
|
export_envs: { |
|
MAIL_PORT: "#{net.port.smtp}", |
|
}, |
|
}, |
|
ngrok: { |
|
// Dependent systems |
|
depends: ["aircrm"], |
|
image : "gullitmiranda/ngrok", |
|
mount_folders: { |
|
'./log': "/#{system.name}/log", |
|
}, |
|
scalable : false, |
|
http : { hostname : "#{manifest.dir}-#{system.name}.#{azk.default_domain}" }, |
|
ports : { |
|
http : "4040" |
|
}, |
|
envs : { |
|
NGROK_LOG : "/#{system.name}/log/ngrok.log", |
|
NGROK_SUBDOMAIN : "aircrm-ml", |
|
NGROK_AUTH : "ehXzJi7CGRc8jj74W1Ed", |
|
} |
|
} |
|
}); |
|
|
|
// Sets a default system (to use: start, stop, status, scale) |
|
setDefault("aircrm") |