Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Create flask upstart script in puppet manifest #1997
Comments
jeff1evesque
changed the title from
Create 'start_flask.pp'
to
Create 'start_webserver.pp'
Jun 30, 2015
added a commit
that referenced
this issue
Jul 1, 2015
|
After #2001 has been resolved, we will move corresponding python package installation from
Then, we can safely remove |
added a commit
that referenced
this issue
Jul 2, 2015
added a commit
that referenced
this issue
Jul 2, 2015
added a commit
that referenced
this issue
Jul 2, 2015
added a commit
that referenced
this issue
Jul 2, 2015
|
We need to create the upstart script,
This will allow us the run the following command: sudo service <servicename> <control>with the following
Note: according to the Ubuntu upstart documentation, the following can ensure that the job defined in
|
added a commit
that referenced
this issue
Jul 3, 2015
added a commit
that referenced
this issue
Jul 3, 2015
added a commit
that referenced
this issue
Jul 3, 2015
|
4f4f564: we forgot that redhat based distros may have a different format for upstart scripts. |
added a commit
that referenced
this issue
Jul 3, 2015
added a commit
that referenced
this issue
Jul 3, 2015
added a commit
that referenced
this issue
Jul 3, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 5, 2015
added a commit
that referenced
this issue
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
jeff1evesque
closed this
in
#2004
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
|
We will make a minor change to the docblock. |
jeff1evesque
reopened this
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
jeff1evesque
referenced this issue
Jul 6, 2015
Merged
#1997: start_webserver.pp, adjust docblock #2008
jeff1evesque
closed this
in
#2008
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
|
We need to fix a minor language typo. |
jeff1evesque
reopened this
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
jeff1evesque
referenced this issue
Jul 6, 2015
Merged
#1997: start_webserver.pp, minor language change #2009
jeff1evesque
closed this
in
#2009
Jul 6, 2015
added a commit
that referenced
this issue
Jul 6, 2015
|
Although, our current upstart script runs manually (and on first system boot, via |
jeff1evesque
reopened this
Jul 8, 2015
jeff1evesque
referenced this issue
Jul 9, 2015
Closed
Initialize database tables in puppet manifest #1962
added a commit
that referenced
this issue
Jul 9, 2015
|
aae5e9b: since our upstart script should have the ability to |
|
Since our custom logs defined in
|
|
After initial For example:
Also, after initial For example:
However, if we check our upstart logs in vagrant@vagrant-ubuntu-trusty-64:/var/log/upstart$ ls
console-setup.log network-interface-eth0.log rsyslog.log
container-detect.log pollinate.log statd.log
cryptdisks.log procps-static-network-up.log systemd-logind.log
gssd.log procps-virtual-filesystems.log ttyS0.logThis means, our flask service did not generate a default log. However, we see our flask service exists, but not running after initial
|
jeff1evesque
changed the title from
Create 'start_webserver.pp'
to
Create flask upstart script in puppet manifest
Jul 9, 2015
|
On the successive
This means our Note: we will assume for now, the other three above cases:
will yield the same |
added a commit
that referenced
this issue
Jul 9, 2015
added a commit
that referenced
this issue
Jul 9, 2015
added a commit
that referenced
this issue
Jul 10, 2015
added a commit
that referenced
this issue
Jul 10, 2015
added a commit
that referenced
this issue
Jul 10, 2015
added a commit
that referenced
this issue
Jul 10, 2015
added a commit
that referenced
this issue
Jul 10, 2015
|
We need to implement the following to ...
pre-start script
[ "$MOUNTPOINT" == "/vagrant" ] || stop
end script
...If that is not successful, we can implement the following in our
followed by the following snippet within ...
start on vagrant-ready
## stop flask server when machine gracefully shuts down
... |
added a commit
that referenced
this issue
Jul 10, 2015
added a commit
that referenced
this issue
Jul 11, 2015
|
e67c5d0: our upstart script,
On successive
So, we need to attempt, and research the following:
|
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
|
80001ca: after numerous vagrant@vagrant-ubuntu-trusty-64:~$ ps aux | grep python
root 1818 3.2 9.0 316912 45328 ? Ss 09:16 0:00 python /vagrant
/app.py
root 1877 6.0 9.1 391032 45864 ? Sl 09:16 0:01 /usr/bin/python
/vagrant/app.py
vagrant 2123 0.0 0.1 10460 936 pts/1 S+ 09:16 0:00 grep --color=au
to pythonNote: since the system has been rebooted more than once, we know that previous service processes, associated with |
|
If we clear the contents of
This means our Note: changing the |
added a commit
that referenced
this issue
Jul 11, 2015
|
We need to define the following:
Otherwise, we get the following within /proc/self/fd/9: 2: /proc/self/fd/9: /vagrant: permission denied
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 763, in run
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 603 in inner
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 462 in serve_forever
File "/usr/lib/python2.7/SocketServer.py", line 241, in serve_forever
File "/usr/lib/python2.7/threading.py", line 585, in set
File "/usr/lib/python2.7/threading.py", line 406, in notifyAll
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat |
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
|
f8036c2, 2d93aed: after numerous * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with statSimilarly, our [Sat Jul 11 17:47:19 UTC 2015] flask server starting
[Sat Jul 11 17:52:11 UTC 2015] flask server stopping
[Sat Jul 11 17:54:00 UTC 2015] flask server starting
[Sat Jul 11 17:54:46 UTC 2015] flask server stopping
[Sat Jul 11 17:56:42 UTC 2015] flask server starting |
added a commit
that referenced
this issue
Jul 11, 2015
|
After * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
/proc/self/fd/9: 2: [: =: unexpected operatorThe reason for this, is because we are running a windows 7 host, and when sudo apt-get install dos2unix
sudo dos2unix /etc/init/flask.confNote: the dos2unix package exists in the |
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
jeff1evesque
closed this
in
#2012
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
|
We need to remove an unnecessary |
jeff1evesque
reopened this
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
jeff1evesque
referenced this issue
Jul 11, 2015
Merged
#1997: start_webserver.pp, remove unnecessary 'notify' #2013
jeff1evesque
closed this
in
#2013
Jul 11, 2015
added a commit
that referenced
this issue
Jul 11, 2015
|
We need to ensure that our * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
/proc/self/fd/9: 2: [: =: unexpected operatorOne solution is the implement the following within ...
## log shut-down date, remove process id from log before '/vagrant' is unmounted
#
# @[`date`], current date script executed
pre-stop script
echo "[`date`] flask server stopping" >> /vagrant/log/flask_server.log
end script
| EOT
notify => Exec['dos2unix-line-endings'],
}
## convert clrf (windows to linux) in case host machine is windows.
exec {'dos2unix-line-endings':
command => 'dos2unix /etc/init/flask.conf',
refreshonly => true,
notify => Service['flask'],
}
## start webserver
service {'flask':
ensure => 'running',
enable => 'true',
}
}
default: {
}
} |
jeff1evesque
reopened this
Jul 11, 2015
added a commit
that referenced
this issue
Jul 13, 2015
added a commit
that referenced
this issue
Jul 13, 2015
added a commit
that referenced
this issue
Jul 13, 2015
jeff1evesque
referenced this issue
Jul 13, 2015
Merged
#1997: ensure proper 'pre-stop script' logs #2015
jeff1evesque
closed this
in
#2015
Jul 13, 2015
added a commit
that referenced
this issue
Jul 13, 2015
|
We need to determine if the following from ...
notify => Service['flask'],
}
## start webserver
service {'flask':
ensure => 'running',
enable => 'true',
}
...The motivation for the above snippet, is because our generated |
jeff1evesque
reopened this
Aug 21, 2015
This was referenced Aug 21, 2015
|
We need to adjust our flask upstart script by implementing another workaround upstart script in order to ensure the |
jeff1evesque
added
the
build
label
Aug 22, 2015
jeff1evesque
added this to the 0.1 milestone
Aug 22, 2015
|
The workaround has been implemented in #2046. However, we will close this issue, since the creation of the upstart script has been resolved, and handle all other bugs, within their own corresponding issue. |
jeff1evesque commentedJun 30, 2015
We need to create
start_webserver.pp. This script will be responsible for installing flask, and defining the necessary upstart script, to ensure that our flask server is running each time the Ubuntu Server has started.The following need to be removed (if present):
flaskin$packages_flask_pip = ['flask', 'requests']frominstall_packages.pp