diff --git a/Dockerfile b/Dockerfile index 759fbb3..3cef407 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,26 +20,27 @@ RUN pip3 install -r placement-requirements.txt # Do this all in one big piece otherwise the nova bits are out of date # Thanks to ingy for figuring out a faster way to do this. +# We must get rid of a symlink which can lead to errors, see: +# https://github.com/python/cpython/pull/4267 RUN git clone --depth=1 https://git.openstack.org/openstack/nova && \ cd nova && \ git fetch --depth=2 --append origin \ - refs/changes/62/549862/11 \ - refs/changes/66/362766/75 \ - refs/changes/35/541435/17 \ + refs/changes/62/549862/14 \ + refs/changes/66/362766/79 \ + refs/changes/35/541435/21 \ + refs/changes/57/553857/2 \ refs/changes/62/543262/7 && \ git cherry-pick $(cut -f1 .git/FETCH_HEAD) && \ - # get rid of a symlink which can lead to errors, see: - # https://github.com/python/cpython/pull/4267 find . -type l -exec rm {} \; && \ pip3 install --no-deps . - # create the placement db ADD sync.py / -ADD /shared/etc/nova/nova.conf / -RUN python3 sync.py --config-file nova.conf +ADD /shared/placement-uwsgi.ini / +RUN mkdir /etc/nova +ADD /shared/etc/nova/nova.conf /etc/nova +RUN python3 sync.py --config-file /etc/nova/nova.conf -# Mount nova config and uwsgi config -VOLUME /shared -ENTRYPOINT ["uwsgi", "--ini", "/shared/placement-uwsgi.ini"] +CMD ["/usr/sbin/uwsgi", "--ini", "/placement-uwsgi.ini"] +EXPOSE 80 diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..84f4cc1 --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 +kind: Deployment +metadata: + name: placement-deployment +spec: + selector: + matchLabels: + app: placement + replicas: 1 + template: + metadata: + labels: + app: placement + spec: + containers: + - name: placement + image: placedock:1.0 + ports: + - containerPort: 80 diff --git a/shared/placement-uwsgi.ini b/shared/placement-uwsgi.ini index a5c08ce..68fd066 100644 --- a/shared/placement-uwsgi.ini +++ b/shared/placement-uwsgi.ini @@ -1,18 +1,43 @@ - [uwsgi] -chmod-socket = 666 -socket = 172.*:80 -lazy-apps = true -add-header = Connection: close -buffer-size = 65535 -hook-master-start = unix_signal:15 gracefully_kill_them_all -thunder-lock = true plugins = python3 -enable-threads = true -worker-reload-mercy = 90 -exit-on-reload = false -die-on-term = true -master = true -processes = 4 wsgi-file = /usr/bin/nova-placement-api -env = OS_PLACEMENT_CONFIG_DIR=/shared/etc/nova + +processes = 2 +threads = 10 + +http-socket = :80 +http-enable-proxy-protocol = 1 +http-auto-chunked = true +http-keepalive = 75 +http-timeout = 75 +stats = :1717 +stats-http = 1 +offload-threads = 10 + +# Better startup/shutdown in docker: +die-on-term = 1 +lazy-apps = 0 + +vacuum = 1 +master = 1 +enable-threads = true +thunder-lock = 1 +buffer-size = 65535 + +# Logging +log-x-forwarded-for = true + +# Avoid errors on aborted client connections +ignore-sigpipe = true +ignore-write-errors = true +disable-write-exception = true + +no-defer-accept = 1 + +# Limits, Kill requests after 120 seconds +harakiri = 120 +harakiri-verbose = true +post-buffering = 4096 + +# Custom headers +add-header = Connection: Keep-Alive