{"action":"created","issue":{"url":"https://api.github.com/repos/open-craft/opencraft/issues/63","repository_url":"https://api.github.com/repos/open-craft/opencraft","labels_url":"https://api.github.com/repos/open-craft/opencraft/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/open-craft/opencraft/issues/63/comments","events_url":"https://api.github.com/repos/open-craft/opencraft/issues/63/events","html_url":"https://github.com/open-craft/opencraft/pull/63","id":151552040,"number":63,"title":"OC-1541: Keep the old instance running while deploying a new one","user":{"login":"bradenmacdonald","id":945577,"avatar_url":"https://avatars.githubusercontent.com/u/945577?v=3","gravatar_id":"","url":"https://api.github.com/users/bradenmacdonald","html_url":"https://github.com/bradenmacdonald","followers_url":"https://api.github.com/users/bradenmacdonald/followers","following_url":"https://api.github.com/users/bradenmacdonald/following{/other_user}","gists_url":"https://api.github.com/users/bradenmacdonald/gists{/gist_id}","starred_url":"https://api.github.com/users/bradenmacdonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradenmacdonald/subscriptions","organizations_url":"https://api.github.com/users/bradenmacdonald/orgs","repos_url":"https://api.github.com/users/bradenmacdonald/repos","events_url":"https://api.github.com/users/bradenmacdonald/events{/privacy}","received_events_url":"https://api.github.com/users/bradenmacdonald/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2016-04-28T05:23:57Z","updated_at":"2016-05-13T07:11:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/open-craft/opencraft/pulls/63","html_url":"https://github.com/open-craft/opencraft/pull/63","diff_url":"https://github.com/open-craft/opencraft/pull/63.diff","patch_url":"https://github.com/open-craft/opencraft/pull/63.patch"},"body":"Changes:\r\n- Fix occasional pylint warning about undocumented Meta classes\r\n- Combine LogEntry classes\r\n    * ^ These two commits have been copied to #67 so they can be reviewed more easily and merged sooner\r\n- Separated `[OpenEdX]Instance` into `Instance` (long-lived, mutable, creates AppServers and marks one as active), and `AppServer` (immutable, owns one VM)\r\n- Factored Open edX specific code into `OpenEdXInstance` and `OpenEdXAppServer` respectively\r\n- Factored Open edX specific code out of the ansible mixin\r\n- Change the ansible mixin so it can optionally run multiple playbooks\r\n- Removed `instance.last_provisioning_started` since you can compute that from the most recent `AppServer.created` field\r\n- Combined `forum_version`, `notifier_version`, `xqueue_version`, and `certs_version` into a single `openedx_release` setting, since these were always set to the same value, and if one needs to be set differently it can be done using ansible_extra_settings anyways.\r\n- Separated PR-watching code to a separate app (`OpenEdXInstance` should not need to know about pull requests)\r\n- Updated API\r\n- Allows provisioning a new AppServer at any time\r\n- Updated UI accordingly\r\n   * Lovely new home screen (\"empty state\"):\r\n     ![screen shot 2016-05-08 at 7 54 01 pm](https://cloud.githubusercontent.com/assets/945577/15102640/ac449f8a-1556-11e6-8e4a-be0c7f0635d4.png)\r\n   * Instance list indicates the state of the active app server for each instance, as well as the state of any newer app server waiting to be provisioned / reviewed / made active.\r\n     ![screen shot 2016-05-08 at 7 54 57 pm](https://cloud.githubusercontent.com/assets/945577/15102662/e3666250-1556-11e6-84bd-5bfda15ec0d3.png)\r\n   * New \"Pull Request\" tab:\r\n      ![screen shot 2016-05-08 at 7 56 40 pm](https://cloud.githubusercontent.com/assets/945577/15102676/0a2c83ec-1557-11e6-8f03-bf4af204a31d.png)\r\n   * When you click \"Update Instance Settings from PR\", it displays an animation while fetching updates from GitHub, then switches to the \"Settings\" tab to show you the new settings / commit hash.\r\n   * New Settings tab for instance settings (should be made editable in the future)\r\n       ![screen shot 2016-05-08 at 7 58 03 pm](https://cloud.githubusercontent.com/assets/945577/15102689/3c7e0244-1557-11e6-85d6-28c310e05219.png)\r\n   * New App Servers tab to review app servers, launch new ones, or change which one is active:\r\n       ![screen shot 2016-05-08 at 7 59 37 pm](https://cloud.githubusercontent.com/assets/945577/15102712/7b6b4e62-1557-11e6-87d5-4e7d2ef4d837.png)\r\n   * Deep linking to any instance or app server :)\r\n- Behavior: The first time a PR is seen, an instance will be auto-provisioned; on failure, the provisioning will be retried (on a new AppServer) up to 1 additional time; on success, the AppServer will automatically be marked active. On the other hand, whenever the user manually provisions a new instance or AppServer, there is no automatic retry or activation. (To give users time to inspect the errors or the new appserver.)\r\n\r\nTODO:\r\n- Update tests\r\n- Update documentation\r\n- Add tests for # of queries used by logging, plus by each API view.\r\n\r\nDeployment notes:\r\n- Run [this SQL](https://gist.github.com/bradenmacdonald/148240764a1aede24ba50fae24119c7b) before deploying to create a backup of the instance_singlevmopenedxinstance data.\r\n\r\nSuggestions for future work:\r\n- Allow stopping an AppServer build\r\n- Allow use of OpenCraft IM without specifying GitHub orgs/repos to watch), i.e. with the new `pr_watch` app disabled\r\n- Add Terminated state to the AppServer classes\r\n- Implement the `WatchedPullRequest` `TODO` items listed in the code"},"comment":{"url":"https://api.github.com/repos/open-craft/opencraft/issues/comments/218968272","html_url":"https://github.com/open-craft/opencraft/pull/63#issuecomment-218968272","issue_url":"https://api.github.com/repos/open-craft/opencraft/issues/63","id":218968272,"user":{"login":"bradenmacdonald","id":945577,"avatar_url":"https://avatars.githubusercontent.com/u/945577?v=3","gravatar_id":"","url":"https://api.github.com/users/bradenmacdonald","html_url":"https://github.com/bradenmacdonald","followers_url":"https://api.github.com/users/bradenmacdonald/followers","following_url":"https://api.github.com/users/bradenmacdonald/following{/other_user}","gists_url":"https://api.github.com/users/bradenmacdonald/gists{/gist_id}","starred_url":"https://api.github.com/users/bradenmacdonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradenmacdonald/subscriptions","organizations_url":"https://api.github.com/users/bradenmacdonald/orgs","repos_url":"https://api.github.com/users/bradenmacdonald/repos","events_url":"https://api.github.com/users/bradenmacdonald/events{/privacy}","received_events_url":"https://api.github.com/users/bradenmacdonald/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T07:11:31Z","updated_at":"2016-05-13T07:11:31Z","body":"I have now updated, fixed, and expanded most of the tests. The only two files I haven't updated yet are `test_instance_mixins` and `test_openedx_instance`, so those unit tests will still be failing."}}