Skip to content

Commit

Permalink
trying to run mock ims with gunicorn, flask is giving 401 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rabellino-noaa committed Jun 27, 2024
1 parent da16dc1 commit fb22847
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docker/mockims/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,23 @@ COPY ./python/idsse_testing/ims_service/profiles/*.json /python/profiles/
# for now.
#VOLUME /python/profiles

ENTRYPOINT [ "python3", "/python/ims_service/ims_service.py" ]
# Run with flask (local only)
#ENTRYPOINT [ "python3", "/python/ims_service/ims_service.py" ]

# Run with gunicorn
ENV PORT 5000
ENV WORKERS 2
ENV LOGLEVEL info

EXPOSE $PORT

# Create entry script to run service
RUN echo "#!/bin/sh" > /app/entry.sh && \
echo "gunicorn --chdir /app -w \${WORKERS} \\" >> /app/entry.sh && \
echo " -b 0.0.0.0:\${PORT} --worker-tmp-dir /dev/shm \\" >> /app/entry.sh && \
echo " --enable-stdio-inheritance --access-logfile - --error-logfile - \\" >> /app/entry.sh && \
echo " --access-logformat '%(h)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\" %(T)s %(M)s' \\" >> /app/entry.sh && \
echo " --log-level \${LOGLEVEL} 'app:app' " >> /app/entry.sh && \
chmod a+x /app/entry.sh

ENTRYPOINT ["/app/entry.sh"]
3 changes: 3 additions & 0 deletions python/idsse_testing/ims_service/src/ims_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

@app.route('/all-events', methods=['GET'])
def profiles():
print('Received GET request for all events, with headers:', request.headers)
print(' request.args.keys are:', request.args.keys())

logger.info('Received GET request for all events, with headers: %s', request.headers)
logger.info(' request.args.keys are: %s', request.args.keys())

Expand Down

0 comments on commit fb22847

Please sign in to comment.