{"action":"created","issue":{"url":"https://api.github.com/repos/elwinar/rambler/issues/20","repository_url":"https://api.github.com/repos/elwinar/rambler","labels_url":"https://api.github.com/repos/elwinar/rambler/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/elwinar/rambler/issues/20/comments","events_url":"https://api.github.com/repos/elwinar/rambler/issues/20/events","html_url":"https://github.com/elwinar/rambler/issues/20","id":188328635,"number":20,"title":"Official Docker Image","user":{"login":"codegoalie","id":75132,"avatar_url":"https://avatars.githubusercontent.com/u/75132?v=3","gravatar_id":"","url":"https://api.github.com/users/codegoalie","html_url":"https://github.com/codegoalie","followers_url":"https://api.github.com/users/codegoalie/followers","following_url":"https://api.github.com/users/codegoalie/following{/other_user}","gists_url":"https://api.github.com/users/codegoalie/gists{/gist_id}","starred_url":"https://api.github.com/users/codegoalie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codegoalie/subscriptions","organizations_url":"https://api.github.com/users/codegoalie/orgs","repos_url":"https://api.github.com/users/codegoalie/repos","events_url":"https://api.github.com/users/codegoalie/events{/privacy}","received_events_url":"https://api.github.com/users/codegoalie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-09T19:14:36Z","updated_at":"2016-12-07T09:00:31Z","closed_at":null,"body":"We're using rambler with Kubernetes to manage out database migrations. We'd love to have an official Docker image instead of building our own. \r\n\r\nCurrently, we are using a rambler binary built from https://github.com/elwinar/rambler/pull/19 which can read config values from the environment. Our Dockerfile is:\r\n\r\n```Dockerfile\r\nFROM alpine\r\n\r\nENV APP_HOME=/migrator\r\nRUN mkdir -p ${APP_HOME}\r\nWORKDIR ${APP_HOME}\r\n\r\nCOPY bin/rambler rambler\r\nCOPY rambler.json rambler.json\r\nCOPY migrations migrations\r\n\r\nCMD [\"./rambler\", \"apply\", \"-a\"]\r\n```\r\n\r\nAn example from our Docker compose file:\r\n\r\n```yaml\r\nversion: '2'\r\nservices:\r\n  migrator:\r\n    build: ./migrator\r\n    volumes:\r\n      - \"./migrator/migrations:/migrator/migrations\"\r\n    depends_on:\r\n      - mysql\r\n    environment:\r\n      RAMBLER_HOST: mysql\r\n      RAMBLER_PORT: 3306\r\n      RAMBLER_USER: user\r\n      RAMBLER_PASSWORD: password\r\n      RAMBLER_DATABASE: db_name\r\n  mysql:\r\n    image: mysql:5.6\r\n    volumes:\r\n      - \"/var/lib/mysql\"\r\n    environment:\r\n      MYSQL_ROOT_PASSWORD: rootpassword\r\n      MYSQL_DATABASE: db_name\r\n      MYSQL_USER: user\r\n      MYSQL_PASSWORD: password\r\n ```\r\n\r\nRight now, rambler will bail out when it can't find a config file, so we've only put the static, non-secret configuration in the file (driver, directory, and protocol).\r\n\r\nThe Kubernetes Job specification looks like:\r\n\r\n```yaml\r\napiVersion: batch/v1\r\nkind: Job\r\nmetadata:\r\n  name: migrator\r\nspec:\r\n  template:\r\n    metadata:\r\n      name: migrator\r\n    spec:\r\n      containers:\r\n      - name: migrator\r\n        image: idnumber.dkr.ecr.us-west-2.amazonaws.com/migrator:v20161102122200\r\n        env:\r\n          - name: RAMBLER_HOST\r\n            valueFrom:\r\n              secretKeyRef:\r\n                name: mysql-configuration\r\n                key: host\r\n          - name: RAMBLER_PORT\r\n            valueFrom:\r\n              secretKeyRef:\r\n                name: mysql-configuration\r\n                key: port\r\n          - name: RAMBLER_DATABASE\r\n            valueFrom:\r\n              secretKeyRef:\r\n                name: mysql-configuration\r\n                key: name\r\n          - name: RAMBLER_USER\r\n            valueFrom:\r\n              secretKeyRef:\r\n                name: mysql-configuration\r\n                key: user\r\n          - name: RAMBLER_PASSWORD\r\n            valueFrom:\r\n              secretKeyRef:\r\n                name: mysql-configuration\r\n                key: password\r\n      restartPolicy: Never\r\n```\r\n\r\nI think specifying the volume locally, like it's being done in the docker-compose file, works really well. However, I'm not sure how that would work in the actual K8s cluster. Perhaps something a [gitRepo volumes](http://kubernetes.io/docs/user-guide/volumes/#gitrepo) would work. Either way, I don't think that's a rambler concern."},"comment":{"url":"https://api.github.com/repos/elwinar/rambler/issues/comments/265392475","html_url":"https://github.com/elwinar/rambler/issues/20#issuecomment-265392475","issue_url":"https://api.github.com/repos/elwinar/rambler/issues/20","id":265392475,"user":{"login":"elwinar","id":4218466,"avatar_url":"https://avatars.githubusercontent.com/u/4218466?v=3","gravatar_id":"","url":"https://api.github.com/users/elwinar","html_url":"https://github.com/elwinar","followers_url":"https://api.github.com/users/elwinar/followers","following_url":"https://api.github.com/users/elwinar/following{/other_user}","gists_url":"https://api.github.com/users/elwinar/gists{/gist_id}","starred_url":"https://api.github.com/users/elwinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elwinar/subscriptions","organizations_url":"https://api.github.com/users/elwinar/orgs","repos_url":"https://api.github.com/users/elwinar/repos","events_url":"https://api.github.com/users/elwinar/events{/privacy}","received_events_url":"https://api.github.com/users/elwinar/received_events","type":"User","site_admin":false},"created_at":"2016-12-07T09:00:31Z","updated_at":"2016-12-07T09:00:31Z","body":"Hi.\r\nAny news about this ?"}}
{"actor":{"display_login":"elwinar"}}