pyIPAM - Docker Plugin for IPAM written in Python
Jacek Kowalski
2020-05-18 f0d935291715742b2e9f71c1b5e1ecbf23d02eff
Replace uwsgi with waitress due to 400 Bad Request issues
4 files modified
1 files deleted
34 ■■■■■ changed files
Dockerfile 4 ●●●● patch | view | raw | blame | history
config.json 6 ●●●● patch | view | raw | blame | history
requirements.txt 1 ●●●● patch | view | raw | blame | history
run.py 7 ●●●● patch | view | raw | blame | history
uwsgi.ini 16 ●●●●● patch | view | raw | blame | history
Dockerfile
@@ -1,6 +1,6 @@
FROM alpine
RUN apk add uwsgi-python3 python3 py3-pip
RUN apk add python3 py3-pip
RUN mkdir -p /run/docker/plugins /usr/src/app \
    && chown -R nobody:nobody /run/docker/plugins /usr/src/app
USER nobody
@@ -12,4 +12,4 @@
COPY --chown=nobody:nobody . .
CMD [ "uwsgi", "--ini", "uwsgi.ini" ]
CMD [ "./run.py" ]
config.json
@@ -2,9 +2,13 @@
    "description": "pyIPAM - IPAM driver in Python",
    "documentation": "https://github.com/jacekkow/docker-plugin-pyipam",
    "workdir": "/usr/src/app",
    "entrypoint": ["uwsgi", "--ini", "uwsgi.ini"],
    "entrypoint": ["./run.py"],
    "env": [
        {
            "name": "ENVIRONMENT",
            "value": "production"
        },
        {
            "name": "HOME",
            "value": "/usr/src/app"
        }
requirements.txt
@@ -1,2 +1,3 @@
docker-plugin-api
Flask
waitress
run.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python3
import logging
import os
import docker_plugin_api.Plugin
import flask
import waitress
app = flask.Flask('pyIPAM')
app.logger.setLevel(logging.DEBUG)
@@ -15,4 +17,7 @@
app.register_blueprint(lib.IpamDriver.app)
if __name__ == '__main__':
    app.run(debug=True)
    if os.environ.get('ENVIRONMENT', 'dev') == 'dev':
        app.run(debug=True)
    else:
        waitress.serve(app, unix_socket='/run/docker/plugins/pyipam.sock', threads=1)
uwsgi.ini
File was deleted