Last active
August 29, 2015 14:22
-
-
Save gullitmiranda/7cf65fe4547777f05692 to your computer and use it in GitHub Desktop.
Azkfile.js to Elixir + Phoenix + Postgres
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 | |
| */ | |
| // Adds the systems that shape your system | |
| systems({ | |
| "hello_phoenix": { | |
| // Dependent systems | |
| depends: ['postgres'], // postgres, mysql, mongodb ... | |
| // More images: http://images.azk.io | |
| image: {"docker": "azukiapp/elixir"}, | |
| // Steps to execute before running instances | |
| provision: [ | |
| "npm install", | |
| "mix do deps.get, compile", | |
| "mix ecto.create", | |
| "mix ecto.migrate", | |
| ], | |
| workdir: '/azk/#{manifest.dir}', | |
| shell: "/bin/bash", | |
| // Phoenix Framework | |
| command: "mix phoenix.server --no-deps-check", | |
| wait: {"retry": 20, "timeout": 1000}, | |
| mounts: { | |
| "/azk/#{manifest.dir}" : sync("."), | |
| // Elixir | |
| "/root/.hex" : path(env.HOME + '/.hex'), | |
| "/azk/#{manifest.dir}/deps" : persistent("#{manifest.dir}/deps"), | |
| "/azk/#{manifest.dir}/_build" : persistent("#{manifest.dir}/_build"), | |
| // Phoenix | |
| "/azk/#{manifest.dir}/node_modules" : persistent("#{manifest.dir}/node_modules"), | |
| "/azk/#{manifest.dir}/priv/static/js" : persistent("#{manifest.dir}/priv/static/js"), | |
| "/azk/#{manifest.dir}/priv/static/css": persistent("#{manifest.dir}/priv/static/css"), | |
| }, | |
| scalable: {"default": 1}, | |
| http: { | |
| domains: [ "#{system.name}.#{azk.default_domain}" ] | |
| }, | |
| ports: { | |
| http: "4000", | |
| }, | |
| envs: { | |
| MIX_ENV: "dev" | |
| }, | |
| }, | |
| 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 | |
| POSTGRES_USER: "azk", | |
| POSTGRES_PASS: "azk", | |
| POSTGRES_DB : "#{manifest.dir}", | |
| }, | |
| export_envs: { | |
| // check this gist to configure your database | |
| // https://github.com/azukiapp/hello_phoenix/blob/master/config/config.exs#L22 | |
| DATABASE_URL: "ecto+postgres://#{envs.POSTGRES_USER}:#{envs.POSTGRES_PASS}@#{net.host}:#{net.port.data}/${envs.POSTGRES_DB}?size=10", | |
| }, | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment