{"action":"created","issue":{"url":"https://api.github.com/repos/zulip/zulip/issues/1100","repository_url":"https://api.github.com/repos/zulip/zulip","labels_url":"https://api.github.com/repos/zulip/zulip/issues/1100/labels{/name}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/1100/comments","events_url":"https://api.github.com/repos/zulip/zulip/issues/1100/events","html_url":"https://github.com/zulip/zulip/pull/1100","id":161796024,"number":1100,"title":"[WIP] Use a virtualenv in production","user":{"login":"sharmaeklavya2","id":3839472,"avatar_url":"https://avatars.githubusercontent.com/u/3839472?v=3","gravatar_id":"","url":"https://api.github.com/users/sharmaeklavya2","html_url":"https://github.com/sharmaeklavya2","followers_url":"https://api.github.com/users/sharmaeklavya2/followers","following_url":"https://api.github.com/users/sharmaeklavya2/following{/other_user}","gists_url":"https://api.github.com/users/sharmaeklavya2/gists{/gist_id}","starred_url":"https://api.github.com/users/sharmaeklavya2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharmaeklavya2/subscriptions","organizations_url":"https://api.github.com/users/sharmaeklavya2/orgs","repos_url":"https://api.github.com/users/sharmaeklavya2/repos","events_url":"https://api.github.com/users/sharmaeklavya2/events{/privacy}","received_events_url":"https://api.github.com/users/sharmaeklavya2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-06-22T21:55:00Z","updated_at":"2016-06-25T22:36:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zulip/zulip/pulls/1100","html_url":"https://github.com/zulip/zulip/pull/1100","diff_url":"https://github.com/zulip/zulip/pull/1100.diff","patch_url":"https://github.com/zulip/zulip/pull/1100.patch"},"body":"The first 2 commits are good and can probably be merged. Please review them.\r\n\r\nThe 3rd commit is the one where I actually use a virtualenv in production. However my attempt failed. Here's what I did:\r\n\r\nI created a production tarball using `tools/build-release-tarball`.\r\n\r\nI set up a production server according to the steps given in [README.prod.md](https://github.com/zulip/zulip/blob/master/README.prod.md), except a few changes:\r\n* I used my own tarball instead of the one [from zulip.com](https://www.zulip.com/dist/releases/zulip-server-latest.tar.gz).\r\n* I used my own certificates instead of using letsencrypt or openssl.\r\n* Instead of doing `su zulip -c /home/zulip/deployments/current/scripts/setup/initialize-database`, I switched to user zulip (`su zulip`), switched to the venv (`source zulip-venv/bin/activate`) and then ran the script (`/home/zulip/deployments/current/scripts/setup/initialize-database`).\r\n\r\nEverything ran as expected. I opened my browser and registered and logged in to zulip. No errors till now.\r\n\r\nNow I wanted to see whether supervisor is actually using my virtualenv. So I logged out from the user `zulip`, which brought me back to the root user's prompt. I then did `apt-get purge python-django`. I again interacted with zulip in my browser and it showed no errors.\r\n\r\nI had almost started celebrating, but it struck me that I should try to `supervisorctl stop all`. That worked. I then did `supervisorctl start all`. That failed with this output (only first 6 lines shown because rest are similar):\r\n```\r\nzulip-django: ERROR (abnormal termination)\r\nzulip-tornado: ERROR (abnormal termination)\r\nprocess-fts-updates: started\r\nzulip-events-user-presence: ERROR (abnormal termination)\r\nzulip-events-user-activity-interval: ERROR (abnormal termination)\r\nzulip-events-user-activity: ERROR (abnormal termination)\r\n```\r\n\r\nApart from `process-fts-updates`, all services had a `ERROR (abnormal termination)`. My browser also displayed 500. This means my venv is not being used.\r\n\r\nI again installed `python-django` and other packages which got removed when I purged `python-django` using apt. Then I did `supervisorctl start all`. That worked. Zulip then ran well on my browser too."},"comment":{"url":"https://api.github.com/repos/zulip/zulip/issues/comments/228573970","html_url":"https://github.com/zulip/zulip/pull/1100#issuecomment-228573970","issue_url":"https://api.github.com/repos/zulip/zulip/issues/1100","id":228573970,"user":{"login":"sharmaeklavya2","id":3839472,"avatar_url":"https://avatars.githubusercontent.com/u/3839472?v=3","gravatar_id":"","url":"https://api.github.com/users/sharmaeklavya2","html_url":"https://github.com/sharmaeklavya2","followers_url":"https://api.github.com/users/sharmaeklavya2/followers","following_url":"https://api.github.com/users/sharmaeklavya2/following{/other_user}","gists_url":"https://api.github.com/users/sharmaeklavya2/gists{/gist_id}","starred_url":"https://api.github.com/users/sharmaeklavya2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharmaeklavya2/subscriptions","organizations_url":"https://api.github.com/users/sharmaeklavya2/orgs","repos_url":"https://api.github.com/users/sharmaeklavya2/repos","events_url":"https://api.github.com/users/sharmaeklavya2/events{/privacy}","received_events_url":"https://api.github.com/users/sharmaeklavya2/received_events","type":"User","site_admin":false},"created_at":"2016-06-25T22:36:49Z","updated_at":"2016-06-25T22:36:49Z","body":"It's done afaik. I checked both install and update (`scripts/setup/install` and `scripts/upgrade-zulip`). I haven't checked other scripts yet."}}
{"actor":{"display_login":"sharmaeklavya2"}}