{"action":"created","issue":{"url":"https://api.github.com/repos/espebra/strapper/issues/1","labels_url":"https://api.github.com/repos/espebra/strapper/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/espebra/strapper/issues/1/comments","events_url":"https://api.github.com/repos/espebra/strapper/issues/1/events","html_url":"https://github.com/espebra/strapper/issues/1","id":112245307,"number":1,"title":"Do you have an example of how to set this up under Apache or Nginx?","user":{"login":"EntropyWorks","id":409125,"avatar_url":"https://avatars.githubusercontent.com/u/409125?v=3","gravatar_id":"","url":"https://api.github.com/users/EntropyWorks","html_url":"https://github.com/EntropyWorks","followers_url":"https://api.github.com/users/EntropyWorks/followers","following_url":"https://api.github.com/users/EntropyWorks/following{/other_user}","gists_url":"https://api.github.com/users/EntropyWorks/gists{/gist_id}","starred_url":"https://api.github.com/users/EntropyWorks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntropyWorks/subscriptions","organizations_url":"https://api.github.com/users/EntropyWorks/orgs","repos_url":"https://api.github.com/users/EntropyWorks/repos","events_url":"https://api.github.com/users/EntropyWorks/events{/privacy}","received_events_url":"https://api.github.com/users/EntropyWorks/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-19T22:23:07Z","updated_at":"2015-12-14T12:37:48Z","closed_at":"2015-12-14T12:37:48Z","body":"I wanted to try this out and create the following strapper.wsgi file.\r\n\r\n```\r\nimport sys, os\r\nsys.path.insert (0,'/var/www/strapper')\r\nos.chdir(\"/var/www/strapper\")\r\nfrom strapper import app as application\r\n```\r\n\r\n\r\nAnd for the apache config I added \r\n\r\n```\r\n<virtualhost *:8080>\r\n\r\n    ErrorLog ${APACHE_LOG_DIR}/strapper-error.log\r\n    CustomLog ${APACHE_LOG_DIR}/strapper-access.log combined\r\n\r\n    WSGIDaemonProcess strapper  user=www-data group=www-data threads=5 home=/var/www/strapper\r\n    WSGIScriptAlias / /var/www/strapper/strapper.wsgi\r\n\r\n    <directory /var/www/strapper>\r\n        WSGIProcessGroup strapper\r\n        #WSGIApplicationGroup %{GLOBAL}\r\n        WSGIApplicationGroup %{ENV:REMOTE_ADDR}\r\n        WSGIScriptReloading On\r\n        Order deny,allow\r\n        Allow from all\r\n    </directory>\r\n</virtualhost>\r\n```\r\nbut when I go and try to add a mac address it fails.\r\n\r\n```\r\ncurl http://strapper.example.com:8080/boot/aa:aa:aa:aa:aa:aa\r\n<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n<html><head>\r\n<title>500 Internal Server Error</title>\r\n</head><body>\r\n<h1>Internal Server Error</h1>\r\n<p>The server encountered an internal error or\r\nmisconfiguration and was unable to complete\r\nyour request.</p>\r\n<p>Please contact the server administrator at\r\n [no address given] to inform them of the time this error occurred,\r\n and the actions you performed just before this error.</p>\r\n<p>More information about this error may be available\r\nin the server error log.</p>\r\n<hr>\r\n<address>Apache/2.4.7 (Ubuntu) Server at picasso-seed.vse.rdlabs.hpecorp.net Port 8080</address>\r\n</body></html>\r\n```\r\n\r\nIn the apache error log.\r\n```\r\n [remote XXX.XXX.XXX.XXX:43028] mod_wsgi (pid=12401): Exception occurred processing WSGI script '/var/www/strapper/strapper.wsgi'.\r\n [remote XXX.XXX.XXX.XXX:43028] Traceback (most recent call last):\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/flask/app.py\", line 1518, in __call__\r\n [remote XXX.XXX.XXX.XXX:43028]     return self.wsgi_app(environ, start_response)\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/flask/app.py\", line 1506, in wsgi_app\r\n [remote XXX.XXX.XXX.XXX:43028]     response = self.make_response(self.handle_exception(e))\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/flask/app.py\", line 1504, in wsgi_app\r\n [remote XXX.XXX.XXX.XXX:43028]     response = self.full_dispatch_request()\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/flask/app.py\", line 1264, in full_dispatch_request\r\n [remote XXX.XXX.XXX.XXX:43028]     rv = self.handle_user_exception(e)\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/flask/app.py\", line 1262, in full_dispatch_request\r\n [remote XXX.XXX.XXX.XXX:43028]     rv = self.dispatch_request()\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/flask/app.py\", line 1248, in dispatch_request\r\n [remote XXX.XXX.XXX.XXX:43028]     return self.view_functions[rule.endpoint](**req.view_args)\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/strapper.py\", line 460, in boot\r\n [remote XXX.XXX.XXX.XXX:43028]     script = get_boot_script(mac)\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/strapper.py\", line 211, in get_boot_script\r\n [remote XXX.XXX.XXX.XXX:43028]     data = read_data(mac)\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/strapper.py\", line 161, in read_data\r\n [remote XXX.XXX.XXX.XXX:43028]     do_log(\"INFO\",\"Discovered a new node with MAC %s\" % (mac))\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/var/www/strapper/strapper.py\", line 391, in do_log\r\n [remote XXX.XXX.XXX.XXX:43028]     remote_addr = cgi.escape(os.environ['REMOTE_ADDR'])\r\n [remote XXX.XXX.XXX.XXX:43028]   File \"/usr/lib/python2.7/UserDict.py\", line 23, in __getitem__\r\n [remote XXX.XXX.XXX.XXX:43028]     raise KeyError(key)\r\n [remote XXX.XXX.XXX.XXX:43028] KeyError: 'REMOTE_ADDR'\r\n```\r\n\r\nI just can't seem to figure out how the 'REMOTE_ADDR' is set correctly.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/espebra/strapper/issues/comments/164426573","html_url":"https://github.com/espebra/strapper/issues/1#issuecomment-164426573","issue_url":"https://api.github.com/repos/espebra/strapper/issues/1","id":164426573,"user":{"login":"espebra","id":382378,"avatar_url":"https://avatars.githubusercontent.com/u/382378?v=3","gravatar_id":"","url":"https://api.github.com/users/espebra","html_url":"https://github.com/espebra","followers_url":"https://api.github.com/users/espebra/followers","following_url":"https://api.github.com/users/espebra/following{/other_user}","gists_url":"https://api.github.com/users/espebra/gists{/gist_id}","starred_url":"https://api.github.com/users/espebra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/espebra/subscriptions","organizations_url":"https://api.github.com/users/espebra/orgs","repos_url":"https://api.github.com/users/espebra/repos","events_url":"https://api.github.com/users/espebra/events{/privacy}","received_events_url":"https://api.github.com/users/espebra/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T12:37:48Z","updated_at":"2015-12-14T12:37:48Z","body":"Hi,\r\n\r\nI've not used strapper for many years, and I don't have any example configuration. I recommend that you fork and look into the code if you're going to use it.\r\n\r\nIf you want an alternative, you may look into [Kickoff](https://github.com/espebra/kickoff). It is still being used in production by Redpill Linpro. On beforehand, I'm sorry for the lack of documentation."}}