Advertisement
Guest User

Untitled

a guest
Apr 18th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.31 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # Get django environment variables
  4. celeryenv=`cat /opt/python/current/env | tr 'n' ',' | sed 's/export //g' | sed 's/$PATH/%(ENV_PATH)s/g' | sed 's/$PYTHONPATH//g' | sed 's/$LD_LIBRARY_PATH//g'`
  5. celeryenv=${celeryenv%?}
  6.  
  7. # Create celery configuraiton script
  8. celeryconf="[program:celeryd-worker]
  9. ; Set full path to celery program if using virtualenv
  10. command=/opt/python/run/venv/bin/celery worker -A wellfie --loglevel=INFO
  11.  
  12. directory=/opt/python/current/app
  13. user=nobody
  14. numprocs=1
  15. stdout_logfile=/var/log/celery-worker.log
  16. stderr_logfile=/var/log/celery-worker.log
  17. autostart=true
  18. autorestart=true
  19. startsecs=10
  20.  
  21. ; Need to wait for currently executing tasks to finish at shutdown.
  22. ; Increase this if you have very long running tasks.
  23. stopwaitsecs = 600
  24.  
  25. ; When resorting to send SIGKILL to the program to terminate it
  26. ; send SIGKILL to its whole process group instead,
  27. ; taking care of its children as well.
  28. killasgroup=true
  29.  
  30. ; if rabbitmq is supervised, set its priority higher
  31. ; so it starts first
  32. priority=998
  33.  
  34. environment=$celeryenv
  35.  
  36. [program:celeryd-beat]
  37. ; Set full path to celery program if using virtualenv
  38. command=/opt/python/run/venv/bin/celery beat -A wellfie --loglevel=INFO --workdir=/tmp -S django
  39.  
  40. directory=/opt/python/current/app
  41. user=nobody
  42. numprocs=1
  43. stdout_logfile=/var/log/celery-beat.log
  44. stderr_logfile=/var/log/celery-beat.log
  45. autostart=true
  46. autorestart=true
  47. startsecs=10
  48.  
  49. ; Need to wait for currently executing tasks to finish at shutdown.
  50. ; Increase this if you have very long running tasks.
  51. stopwaitsecs = 600
  52.  
  53. ; When resorting to send SIGKILL to the program to terminate it
  54. ; send SIGKILL to its whole process group instead,
  55. ; taking care of its children as well.
  56. killasgroup=true
  57.  
  58. ; if rabbitmq is supervised, set its priority higher
  59. ; so it starts first
  60. priority=998
  61.  
  62. environment=$celeryenv"
  63.  
  64. # Create the celery supervisord conf script
  65. echo "$celeryconf" | tee /opt/python/etc/celery.conf
  66.  
  67. # Add configuration script to supervisord conf (if not there already)
  68. if ! grep -Fxq "[include]" /opt/python/etc/supervisord.conf
  69. then
  70. echo "[include]" | tee -a /opt/python/etc/supervisord.conf
  71. echo "files: celery.conf" | tee -a /opt/python/etc/supervisord.conf
  72. fi
  73.  
  74. # Reread the supervisord config
  75. supervisorctl -c /opt/python/etc/supervisord.conf reread
  76.  
  77. # Update supervisord in cache without restarting all services
  78. supervisorctl -c /opt/python/etc/supervisord.conf update
  79.  
  80. # Start/Restart celeryd through supervisord
  81. supervisorctl -c /opt/python/etc/supervisord.conf restart celeryd
  82.  
  83. [2017-04-18 18:48:06,042: CRITICAL/MainProcess] Unrecoverable error: ImportError('No module named xxxx.toi3pr.0001.usw2.cache.amazonaws.com',)
  84. Traceback (most recent call last):
  85. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/worker/worker.py", line 203, in start
  86. self.blueprint.start(self)
  87. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/bootsteps.py", line 115, in start
  88. self.on_start()
  89. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/apps/worker.py", line 143, in on_start
  90. self.emit_banner()
  91. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/apps/worker.py", line 158, in emit_banner
  92. ' n', self.startup_info(artlines=not use_image))),
  93. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/apps/worker.py", line 221, in startup_info
  94. results=self.app.backend.as_uri(),
  95. File "/opt/python/run/venv/local/lib/python2.7/site-packages/kombu/utils/objects.py", line 44, in __get__
  96. value = obj.__dict__[self.__name__] = self.__get(obj)
  97. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/app/base.py", line 1182, in backend
  98. return self._get_backend()
  99. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/app/base.py", line 900, in _get_backend
  100. self.loader)
  101. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/app/backends.py", line 65, in by_url
  102. return by_name(backend, loader), url
  103. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/app/backends.py", line 45, in by_name
  104. cls = symbol_by_name(backend, aliases)
  105. File "/opt/python/run/venv/local/lib/python2.7/site-packages/kombu/utils/imports.py", line 56, in symbol_by_name
  106. module = imp(module_name, package=package, **kwargs)
  107. File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
  108. __import__(name)
  109. ImportError: No module named xxxx.toi3pr.0001.usw2.cache.amazonaws.com
  110.  
  111. ImportError: No module named wellfie
  112. Traceback (most recent call last):
  113. File "/opt/python/run/venv/bin/celery", line 9, in <module>
  114. load_entry_point('celery==4.0.2', 'console_scripts', 'celery')()
  115. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/__main__.py", line 14, in main
  116. _main()
  117. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/bin/celery.py", line 326, in main
  118. cmd.execute_from_commandline(argv)
  119. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/bin/celery.py", line 488, in execute_from_commandline
  120. super(CeleryCommand, self).execute_from_commandline(argv)))
  121. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/bin/base.py", line 279, in execute_from_commandline
  122. argv = self.setup_app_from_commandline(argv)
  123. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/bin/base.py", line 481, in setup_app_from_commandline
  124. self.app = self.find_app(app)
  125. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/bin/base.py", line 503, in find_app
  126. return find_app(app, symbol_by_name=self.symbol_by_name)
  127. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/app/utils.py", line 355, in find_app
  128. sym = symbol_by_name(app, imp=imp)
  129. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/bin/base.py", line 506, in symbol_by_name
  130. return imports.symbol_by_name(name, imp=imp)
  131. File "/opt/python/run/venv/local/lib/python2.7/site-packages/kombu/utils/imports.py", line 56, in symbol_by_name
  132. module = imp(module_name, package=package, **kwargs)
  133. File "/opt/python/run/venv/local/lib/python2.7/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
  134. return imp(module, package=package)
  135. File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
  136. __import__(name)
  137. ImportError: No module named wellfie
  138.  
  139. [2017-04-18T19:50:23.354Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployEnactHook/01flip.py] : Starting activity...
  140. [2017-04-18T19:50:28.095Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployEnactHook/01flip.py] : Completed activity. Result:
  141. httpd: stopped
  142. httpd: started
  143. httpd RUNNING pid 11508, uptime 0:00:03
  144. [2017-04-18T19:50:28.095Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Starting activity...
  145. [2017-04-18T19:50:28.195Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Completed activity. Result:
  146. + chmod 0755 /var/run/httpd
  147. + /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy httpd
  148. + /opt/elasticbeanstalk/bin/healthd-track-pidfile --name application --location /opt/python/run/supervisord.pid
  149. [2017-04-18T19:50:28.195Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployEnactHook] : Completed activity. Result:
  150. Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
  151. [2017-04-18T19:50:28.195Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployPostHook] : Starting activity...
  152. [2017-04-18T19:50:28.195Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployPostHook/run_supervised_celeryd.sh] : Starting activity...
  153. [2017-04-18T19:50:28.487Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployPostHook/run_supervised_celeryd.sh] : Completed activity. Result:
  154. [program:celeryd-worker]
  155. ; Set full path to celery program if using virtualenv
  156. command=/opt/python/run/venv/bin/celery worker -A wellfie --loglevel=INFO
  157.  
  158. directory=/opt/python/current/app
  159. user=nobody
  160. numprocs=1
  161. stdout_logfile=/var/log/celery-worker.log
  162. stderr_logfile=/var/log/celery-worker.log
  163. autostart=true
  164. autorestart=true
  165. startsecs=10
  166.  
  167. ; Need to wait for currently executing tasks to finish at shutdown.
  168. ; Increase this if you have very long running tasks.
  169. stopwaitsecs = 600
  170.  
  171. ; When resorting to send SIGKILL to the program to terminate it
  172. ; send SIGKILL to its whole process group instead,
  173. ; taking care of its children as well.
  174. killasgroup=true
  175.  
  176. ; if rabbitmq is supervised, set its priority higher
  177. ; so it starts first
  178. priority=998
  179.  
  180. environment=PYTHONPATH="/opt/python/current/app/:",PATH="/opt/python/run/venv/bin/:%(ENV_PATH)s",RDS_PORT="5432",PYTHONPATH="/opt/python/current/app/wellfie:",REDIS_URL="bbbbb.bbbbb.0001.usw2.cache.amazonaws.com:6379",RDS_DB_NAME="bbbdb",DJANGO_SETTINGS_MODULE="wellfie.settings",RDS_USERNAME="aaaa",RDS_PASSWORD="bbbb",RDS_HOSTNAME="bbbbb.bbbbb.us-west-2.rds.amazonaws.com"
  181.  
  182. [program:celeryd-beat]
  183. ; Set full path to celery program if using virtualenv
  184. command=/opt/python/run/venv/bin/celery beat -A wellfie --loglevel=INFO --workdir=/tmp -S django
  185.  
  186. directory=/opt/python/current/app
  187. user=nobody
  188. numprocs=1
  189. stdout_logfile=/var/log/celery-beat.log
  190. stderr_logfile=/var/log/celery-beat.log
  191. autostart=true
  192. autorestart=true
  193. startsecs=10
  194.  
  195. ; Need to wait for currently executing tasks to finish at shutdown.
  196. ; Increase this if you have very long running tasks.
  197. stopwaitsecs = 600
  198.  
  199. ; When resorting to send SIGKILL to the program to terminate it
  200. ; send SIGKILL to its whole process group instead,
  201. ; taking care of its children as well.
  202. killasgroup=true
  203.  
  204. ; if rabbitmq is supervised, set its priority higher
  205. ; so it starts first
  206. priority=998
  207.  
  208. environment=PYTHONPATH="/opt/python/current/app/:",PATH="/opt/python/run/venv/bin/:%(ENV_PATH)s",RDS_PORT="5432",PYTHONPATH="/opt/python/current/app/wellfie:",REDIS_URL="bbbbb.bbbbb.0001.usw2.cache.amazonaws.com:6379",RDS_DB_NAME="bbbdb",DJANGO_SETTINGS_MODULE="wellfie.settings",RDS_USERNAME="aaaa",RDS_PASSWORD="bbbb",RDS_HOSTNAME="bbbbb.bbbbb.us-west-2.rds.amazonaws.com"
  209. No config updates to processes
  210. celeryd: ERROR (no such process)
  211. celeryd: ERROR (no such process)
  212. [2017-04-18T19:50:28.487Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1/AppDeployPostHook] : Completed activity. Result:
  213. Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
  214. [2017-04-18T19:50:28.487Z] INFO [11290] - [Application update app-721b-170418_214950@45/AppDeployStage1] : Completed activity. Result:
  215. Application version switch - Command CMD-AppDeploy stage 1 completed
  216. [2017-04-18T19:50:28.487Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter] : Starting activity...
  217. [2017-04-18T19:50:28.487Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigLogRotation] : Starting activity...
  218. [2017-04-18T19:50:28.488Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
  219. [2017-04-18T19:50:28.563Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
  220. Disabled forced hourly log rotation.
  221. [2017-04-18T19:50:28.564Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
  222. Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
  223. [2017-04-18T19:50:28.564Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigCWLAgent] : Starting activity...
  224. [2017-04-18T19:50:28.564Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigCWLAgent/10-config.sh] : Starting activity...
  225. [2017-04-18T19:50:28.677Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigCWLAgent/10-config.sh] : Completed activity. Result:
  226. Log streaming option setting is not specified, ignore cloudwatch logs setup.
  227.  
  228. Disabled log streaming.
  229. [2017-04-18T19:50:28.678Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter/ConfigCWLAgent] : Completed activity. Result:
  230. Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logstreaming/hooks/config.
  231. [2017-04-18T19:50:28.678Z] INFO [11290] - [Application update app-721b-170418_214950@45/AddonsAfter] : Completed activity.
  232. [2017-04-18T19:50:28.678Z] INFO [11290] - [Application update app-721b-170418_214950@45] : Completed activity. Result:
  233. Application update - Command CMD-AppDeploy succeeded
  234. [2017-04-18T19:50:40.404Z] INFO [11617] - [CMD-TailLogs] : Starting activity...
  235. [2017-04-18T19:50:40.404Z] INFO [11617] - [CMD-TailLogs/AddonsBefore] : Starting activity...
  236. [2017-04-18T19:50:40.404Z] INFO [11617] - [CMD-TailLogs/AddonsBefore] : Completed activity.
  237. [2017-04-18T19:50:40.404Z] INFO [11617] - [CMD-TailLogs/TailLogs] : Starting activity...
  238. [2017-04-18T19:50:40.404Z] INFO [11617] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...
  239.  
  240. ; Set full path to celery program if using virtualenv
  241. command=/opt/python/run/venv/bin/celery worker -A wellfie --loglevel=INFO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement