Skip to content

Instantly share code, notes, and snippets.

@gullitmiranda
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gullitmiranda/9c3f18c4d09c8ba614a4 to your computer and use it in GitHub Desktop.
Save gullitmiranda/9c3f18c4d09c8ba614a4 to your computer and use it in GitHub Desktop.
Azkfile by Magnetis
/**
* Documentation: http://docs.azk.io/Azkfile.js
*/
// Adds the systems that shape your system
systems({
magnetis: {
// Dependent systems
depends: ["postgres", "redis", "elasticsearch"],
// More images: http://images.azk.io
image: { docker: "azukiapp/ruby" },
// Steps to execute before running instances
provision: [
"bundle install --path /azk/bundler",
"bundle exec rake db:create",
"bundle exec rake db:migrate",
"npm install -g bower",
"bower install --save",
],
workdir: "/azk/#{manifest.dir}",
shell: "/bin/bash",
command: "bundle exec rails server --pid /tmp/rails.pid --port $HTTP_PORT",
wait: {"retry": 50, "timeout": 1000},
mounts: {
'/azk/#{manifest.dir}': path("."),
'/azk/bundler': persistent("bundler"),
},
scalable: {"default": 1},
http: {
// magnetis.dev.azk.io
domains: [ "#{system.name}.#{azk.default_domain}" ]
},
envs: {
// set instances variables
//HTTP_PORT: 8080,
RUBY_ENV: "development",
RAILS_ENV: "development",
BUNDLE_APP_CONFIG: "/azk/bundler",
GITHUB_TOKEN: "a0f1bfee54440fa767266b76cd5169f01b4c2634",
},
},
redis: {
image: { docker: 'redis:2.6' },
shell: '/bin/bash',
ports: {
// exports global variables
portA: "6379:6379/tcp",
},
},
elasticsearch: {
image: { docker: 'dockerfile/elasticsearch' },
shell: '/bin/bash',
wait: {"retry": 50, "timeout": 1000},
ports: {
// exports global variables
portA: "9200/http",
portB: "9300/tcp",
},
export_envs: {
ELASTICSEARCH_URL: "http://#{net.host}:#{net.port.portA}",
}
},
postgres: {
// Dependent systems
depends: [], // postgres, postgres, mongodb ...
// More images: http://images.azk.io
image: { "docker": "azukiapp/postgres"} ,
shell: "/bin/bash",
wait: {"retry": 25, "timeout": 1000},
mounts: {
'/var/lib/postgresql': persistent("postgresql-#{system.name}"),
'/var/log/postgresql': path("./log/postgresql"),
},
ports: {
// exports global variables
data: "5432/tcp",
},
envs: {
// set instances variables
POSTGRESQL_USER: "azk",
POSTGRESQL_PASS: "azk",
POSTGRESQL_DB : "#{system.name}_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
DATABASE_URL: "postgres://#{envs.POSTGRESQL_USER}:#{envs.POSTGRESQL_PASS}@#{net.host}:#{net.port.data}/${envs.POSTGRESQL_DB}",
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment