{"action":"created","issue":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2353","repository_url":"https://api.github.com/repos/cfpb/cfgov-refresh","labels_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2353/labels{/name}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2353/comments","events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2353/events","html_url":"https://github.com/cfpb/cfgov-refresh/pull/2353","id":173809223,"number":2353,"title":"Just a little docker","user":{"login":"rosskarchner","id":235397,"avatar_url":"https://avatars.githubusercontent.com/u/235397?v=3","gravatar_id":"","url":"https://api.github.com/users/rosskarchner","html_url":"https://github.com/rosskarchner","followers_url":"https://api.github.com/users/rosskarchner/followers","following_url":"https://api.github.com/users/rosskarchner/following{/other_user}","gists_url":"https://api.github.com/users/rosskarchner/gists{/gist_id}","starred_url":"https://api.github.com/users/rosskarchner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosskarchner/subscriptions","organizations_url":"https://api.github.com/users/rosskarchner/orgs","repos_url":"https://api.github.com/users/rosskarchner/repos","events_url":"https://api.github.com/users/rosskarchner/events{/privacy}","received_events_url":"https://api.github.com/users/rosskarchner/received_events","type":"User","site_admin":false},"labels":[{"id":255623303,"url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels/Back-end","name":"Back-end","color":"eb6420","default":false},{"id":429618373,"url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels/work%20in%20progress","name":"work in progress","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-08-29T16:01:10Z","updated_at":"2016-12-15T16:46:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2353","html_url":"https://github.com/cfpb/cfgov-refresh/pull/2353","diff_url":"https://github.com/cfpb/cfgov-refresh/pull/2353.diff","patch_url":"https://github.com/cfpb/cfgov-refresh/pull/2353.patch"},"body":"Provides dockerfiles and docker-compose configuration for spinning up a self-contained development environment. If we decide this is the future, then users won't need to worry about locally running MySQL, elasticsearch, PDFReactor and friends in order to work on the site. \r\n\r\nThere are also some new \"batteries included\" that have never been a part of our standard development environment, but should prove useful:\r\n- phpMyAdmin, which provides a web-based gui for inspecting and managing the database.\r\n- fakeS3, which lets us simulate Amazon S3 while working locally. Django is configured to use this for media and image uploads.\r\n\r\nI have a few more goals for this before it is merged, but feel free to kick it around, make it better, and contribute ideas here!\r\n\r\nTodo:\r\n- [ ] Instructions for running tests. Bonus: Have Travis use Docker.\r\n- [ ] Have a process /  instructions for working on external apps/ sheer sites \r\n- [ ] Integrate instructions into the 'installation' doc\r\n- [ ] provide a way to grab missing media from S3\r\n## Testing\r\n### first time\r\n\r\nGet the docker bits:\r\n\r\n`brew install docker docker-compose docker-machine`\r\n\r\nCreate a VM for running the docker daemon:\r\n\r\n`docker-machine create default --driver virtualbox --virtualbox-cpu-count \"2\"  --virtualbox-memory \"3072\"`\r\n\r\n(There are [a lot of options available](https://docs.docker.com/machine/reference/create/#/accessing-driver-specific-flags-in-the-help-text)-- these might not be the ideal settings. In particular, [more cpu's isn't necessarily faster](https://github.com/docker/machine/issues/3420#issuecomment-223152559))\r\n\r\n`./docker/map-ports-to-localhost.sh`\r\n\r\n(this maps a number of useful ports to localhost)\r\n\r\nYou need a license in order for pdfreactor to work. Download this text file from our github enterprise (cfgov/platform), and drop in into your cfgov-refresh folder: /CFGOV/platform/blob/master/pdfreactor_key.txt\r\n### every time\r\n\r\n`eval $(docker-compose env)`\r\n(this connects the local docker utilities to the daemon running in the virtual machine we created above)\r\n\r\n`docker-compose up`\r\n\r\nThis uses the configuration in docker-compose.yml to build and spin up a set of containers. This takes about 15 minutes on my machine, the first time. Subsequent launches will be MUCH faster.\r\n\r\nWhen it's done you should be able to check out:\r\n\r\nhttp://localhost:8000/  (django)\r\nhttp://localhost:3000/ (gulp watch/browsersync)\r\nhttp://localhost:9423/ (PDFReactor Demo)\r\nhttp://localhost:8080/phpMyAdmin/   (phpMyAdmin. log in with any name and any password, but neither can be blank)\r\n\r\nChanges to python files or static assets should take affect immediately. Changes to python requirements or package.json will require either:\r\n\r\n`docker-compose build django` or `docker-compose build gulp`\r\n\r\nIf you would like to interact with django on the command line, in another terminal tab, run:\r\n- `eval $(docker-compose env)`\r\n- `docker-compose run django django-admin [subcommand]`, where [subcommand] is any [django management command](https://docs.djangoproject.com/en/1.8/ref/django-admin/).\r\n\r\nHitting control-c will stop all of the running containers.\r\n### importing a database:\r\n\r\nDrop the file you want to load into the 'dbupload' folder. Log into phpMyAdmin, click the 'import' tab, and check the 'select from the webserver upload directory' option.\r\n\r\n<img width=\"810\" alt=\"screen shot 2016-08-29 at 3 15 48 pm\" src=\"https://cloud.githubusercontent.com/assets/235397/18064011/80cf3b28-6dfb-11e6-8458-b345d61c11b0.png\">\r\n\r\nFiles can be uncompressed SQL, or can be zipped or gzipped.\r\n### taking a break\r\n\r\nYou can spin down the Docker vm with:\r\n\r\n`docker-machine stop` You will then need to `docker-machine start` to start back up again.\r\n\r\n### Satellite apps\r\n\r\n- Any apps checked out in the develop-apps directory will be `pip install -e`'ed when the Django container starts. This is helpful for apps that don't have a front-end build (like [django-hud](https://github.com/cfpb/django-hud)), but for apps like AskCFPB and regulations-site, you're left to figure out the front-end on your own (using a local copy of Node, etc).\r\n- There is not yet a strategy here for sheer sites.\r\n\r\n## Review\r\n- @user\r\n## Screenshots\r\n## Notes\r\n## \r\n## Todos\r\n## \r\n## Checklist\r\n- [ ] Changes are limited to a single goal (no scope creep)\r\n- [ ] Code can be automatically merged (no conflicts)\r\n- [ ] Code follows the standards laid out in the [front end playbook](https://github.com/cfpb/front-end)\r\n- [ ] Passes all existing automated tests\r\n- [ ] New functions include new tests\r\n- [ ] New functions are documented (with a description, list of inputs, and expected output)\r\n- [ ] Placeholder code is flagged\r\n- [ ] Visually tested in supported browsers and devices\r\n- [ ] Project documentation has been updated (including the \"Unreleased\" section of the CHANGELOG)\r\n"},"comment":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/comments/267377758","html_url":"https://github.com/cfpb/cfgov-refresh/pull/2353#issuecomment-267377758","issue_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2353","id":267377758,"user":{"login":"rosskarchner","id":235397,"avatar_url":"https://avatars.githubusercontent.com/u/235397?v=3","gravatar_id":"","url":"https://api.github.com/users/rosskarchner","html_url":"https://github.com/rosskarchner","followers_url":"https://api.github.com/users/rosskarchner/followers","following_url":"https://api.github.com/users/rosskarchner/following{/other_user}","gists_url":"https://api.github.com/users/rosskarchner/gists{/gist_id}","starred_url":"https://api.github.com/users/rosskarchner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosskarchner/subscriptions","organizations_url":"https://api.github.com/users/rosskarchner/orgs","repos_url":"https://api.github.com/users/rosskarchner/repos","events_url":"https://api.github.com/users/rosskarchner/events{/privacy}","received_events_url":"https://api.github.com/users/rosskarchner/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T16:46:36Z","updated_at":"2016-12-15T16:46:36Z","body":"I just realized PDFReactor needs some work"}}
{"actor":{"display_login":"rosskarchner"}}