Make up now starts a development environment
Change-Id: I96549e4a6af70c9f90d3bf3d375f9ed59e636b1e
This commit is contained in:
parent
49e537bc67
commit
fc99a34956
@ -12,23 +12,18 @@ RUN pip install python-surveilclient
|
|||||||
|
|
||||||
# Download packs
|
# Download packs
|
||||||
RUN apt-get install -y subversion && \
|
RUN apt-get install -y subversion && \
|
||||||
## Packs
|
|
||||||
svn checkout https://github.com/savoirfairelinux/monitoring-tools/trunk/packs/generic-host /packs/generic-host && \
|
svn checkout https://github.com/savoirfairelinux/monitoring-tools/trunk/packs/generic-host /packs/generic-host && \
|
||||||
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/packs/linux-glance /packs/linux-glance && \
|
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/packs/linux-glance /packs/linux-glance && \
|
||||||
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/packs/linux-keystone /packs/linux-keystone && \
|
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/packs/linux-keystone /packs/linux-keystone && \
|
||||||
apt-get remove -y subversion
|
apt-get remove -y subversion
|
||||||
|
|
||||||
# Copy files
|
|
||||||
ADD surveil /surveil/surveil
|
|
||||||
ADD setup.cfg /surveil/setup.cfg
|
|
||||||
ADD requirements.txt surveil/requirements.txt
|
ADD requirements.txt surveil/requirements.txt
|
||||||
ADD setup.py /surveil/setup.py
|
ADD setup.py /surveil/setup.py
|
||||||
|
ADD setup.cfg /surveil/setup.cfg
|
||||||
ADD .git /surveil/.git
|
ADD .git /surveil/.git
|
||||||
ADD README.rst surveil/README.rst
|
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
RUN pip install -r /surveil/requirements.txt
|
RUN pip install -r /surveil/requirements.txt
|
||||||
RUN cd surveil && python setup.py install
|
|
||||||
|
|
||||||
# Supervisor
|
# Supervisor
|
||||||
ADD tools/docker/surveil_container/etc/supervisor /etc/supervisor
|
ADD tools/docker/surveil_container/etc/supervisor /etc/supervisor
|
||||||
@ -37,4 +32,6 @@ ADD tools/docker/surveil_container/etc/supervisor /etc/supervisor
|
|||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD sleep 20 && \
|
CMD sleep 20 && \
|
||||||
|
cd /surveil/ && \
|
||||||
|
python setup.py develop && \
|
||||||
/usr/bin/supervisord
|
/usr/bin/supervisord
|
||||||
|
@ -17,3 +17,6 @@ at the root of the repository with commands to make it easier to use:
|
|||||||
|
|
||||||
Configuration for the different services running in the Docker container are
|
Configuration for the different services running in the Docker container are
|
||||||
stored in tools/docker.
|
stored in tools/docker.
|
||||||
|
|
||||||
|
Surveil container mounts your local project folder and pecan reloads every
|
||||||
|
time the project files change thus providing a proper development environment.
|
||||||
|
2
fig.yml
2
fig.yml
@ -6,6 +6,8 @@ surveil:
|
|||||||
- shinken
|
- shinken
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
|
volumes:
|
||||||
|
- ./surveil/:/surveil/
|
||||||
|
|
||||||
shinken:
|
shinken:
|
||||||
build: tools/docker/shinken_container/
|
build: tools/docker/shinken_container/
|
||||||
|
@ -2,3 +2,4 @@ pecan>=0.5.0
|
|||||||
pymongo>=2.7.2
|
pymongo>=2.7.2
|
||||||
wsme
|
wsme
|
||||||
requests
|
requests
|
||||||
|
watchdog
|
||||||
|
@ -15,41 +15,13 @@
|
|||||||
"""Starter script for the Surveil API service."""
|
"""Starter script for the Surveil API service."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from wsgiref import simple_server
|
import subprocess
|
||||||
|
import sys
|
||||||
import pecan
|
|
||||||
|
|
||||||
from surveil import api
|
from surveil import api
|
||||||
from surveil.api import app as api_app
|
|
||||||
|
|
||||||
|
|
||||||
# TODO(aviau): Load conf from oslo
|
|
||||||
def get_pecan_config():
|
|
||||||
# Set up the pecan configuration
|
|
||||||
filename = os.path.join(os.path.dirname(api.__file__), "config.py")
|
|
||||||
return pecan.configuration.conf_from_file(filename)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg = get_pecan_config()
|
filename = os.path.join(os.path.dirname(api.__file__), "config.py")
|
||||||
|
subprocess.Popen(['pecan', 'serve', '--reload', filename],
|
||||||
app = api_app.setup_app(cfg)
|
stdin=sys.stdout, stdout=sys.stdout)
|
||||||
|
|
||||||
# Create the WSGI server and start it
|
|
||||||
host, port = cfg.server.host, cfg.server.port
|
|
||||||
srv = simple_server.make_server(host, port, app)
|
|
||||||
|
|
||||||
# TODO(aviau): Logging. don't print :o)
|
|
||||||
print ('Starting server in PID %s' % os.getpid())
|
|
||||||
|
|
||||||
if host == '0.0.0.0':
|
|
||||||
print (
|
|
||||||
'serving on 0.0.0.0:%(port)s, view at http://127.0.0.1:%(port)s' %
|
|
||||||
dict(port=port)
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
print (
|
|
||||||
'serving on http://%(host)s:%(port)s' % dict(host=host, port=port)
|
|
||||||
)
|
|
||||||
|
|
||||||
srv.serve_forever()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user