Last active
April 2, 2016 17:09
-
-
Save dlanileonardo/be7651547ffe5b8f58a8 to your computer and use it in GitHub Desktop.
Rails Azkfile.js app with MySQL, Sidekiq,Mongodb and Redis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Documentation: http://docs.azk.io/Azkfile.js | |
*/ | |
systems({ | |
app: { | |
depends: [ | |
'mongodb', 'mysql', 'redis', 'sidekiq' | |
], | |
image: { docker: "azukiapp/ruby:2.2"}, | |
provision: [ | |
"bundle install --path /azk/bundler", | |
], | |
workdir: "/azk/#{manifest.dir}", | |
command: "bundle exec thin start", | |
shell: "/bin/bash", | |
mounts: { | |
"/azk/#{manifest.dir}": path('app'), | |
"/azk/bundler": {type: 'persistent', value: 'bundler'}, | |
}, | |
scalable: {"default": 1}, | |
http: { | |
domains: ["#{system.name}.#{azk.default_domain}"] | |
}, | |
ports: { | |
http: "3000/tcp", | |
}, | |
envs: { | |
RUBY_ENV: "development", | |
RACK_ENV: "development", | |
RAILS_ENV: "development", | |
ENABLE_AZK: true, | |
HOST: "#{system.name}.#{azk.default_domain}", | |
}, | |
export_envs: { | |
HTTP_PORT: "#{azk.default_domain}:#{net.port.http}", | |
HTTPS_PORT: "#{azk.default_domain}:#{net.port.http}", | |
}, | |
wait: { retry: 3, timeout: 7000 } | |
}, | |
sidekiq: { | |
depends: [ | |
'mongodb', 'mysql', 'redis' | |
], | |
image: { docker: "azukiapp/ruby:2.2"}, | |
provision: [ | |
"bundle install --path /azk/bundler", | |
], | |
workdir: "/azk/#{manifest.dir}", | |
command: "bundle exec foreman start", | |
shell: "/bin/bash", | |
mounts: { | |
"/azk/#{manifest.dir}": path('sidekiq'), | |
"/azk/bundler": {type: 'persistent', value: 'bundler'}, | |
}, | |
scalable: {"default": 1}, | |
envs: { | |
RUBY_ENV: "development", | |
RACK_ENV: "development", | |
RAILS_ENV: "development", | |
ENABLE_AZK: true, | |
HOST: "#{system.name}.#{azk.default_domain}", | |
}, | |
wait: { retry: 3, timeout: 7000 } | |
}, | |
mysql: { | |
image: { docker: "mysql:5.7" }, | |
provision: [ | |
"rm -rf /azk/data/*", | |
"rm -rf /azk/data/.*", | |
"mysql_install_db --datadir=/azk/data --mysqld-file=/usr/sbin/mysqld --user=mysql", | |
], | |
command: "mysqld --skip-name-resolve --skip-host-cache --skip-grant-tables --skip-innodb --innodb=OFF --datadir=/azk/data", | |
shell: "/bin/bash", | |
scalable: {"default": 1}, | |
mounts: { | |
"/azk/data": persistent("data") | |
}, | |
ports: { | |
data: "3306/tcp", | |
}, | |
envs: { | |
MYSQL_USER: "root", | |
}, | |
export_envs: { | |
MYSQL_PORT: "#{net.port.data}", | |
MYSQL_HOST: "#{net.host}", | |
DATABASE_URL: "mysql2://#{envs.MYSQL_USER}@#{net.host}:#{net.port.data}/database_development", | |
}, | |
}, | |
mongodb: { | |
image: { docker: "mongo:2.4.10"}, | |
provision: [ | |
], | |
command: "mongod --noauth --journal --dbpath=/azk/data", | |
shell: "/bin/bash", | |
scalable: {"default": 1}, | |
mounts: { | |
"/azk/data": persistent("data") | |
}, | |
ports: { | |
data: "27017/tcp", | |
}, | |
export_envs: { | |
AZK_MONGO_PORT: "#{net.port.data}", | |
AZK_MONGO_HOST: "#{net.host}", | |
AZK_MONGO_HOST_PORT: "#{net.host}:#{net.port.data}", | |
MONGODB_URI: "mongodb://#{net.host}:#{net.port.data}/database_development", | |
}, | |
wait: { retry: 7, timeout: 7000 }, | |
}, | |
redis: { | |
image: { docker: "redis:2.8"}, | |
shell: "/bin/bash", | |
scalable: {"default": 1}, | |
mounts: { | |
"/data": persistent('redis') | |
}, | |
ports: { | |
data: "6379/tcp" | |
}, | |
envs: { | |
AZK_REDIS_PORT: "#{net.port.data}", | |
}, | |
export_envs: { | |
AZK_REDIS_URL: "redis://#{net.host}:#{net.port.data}/database_development", | |
}, | |
}, | |
}); | |
setDefault("app") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment