Skip to content

Instantly share code, notes, and snippets.

@jamesbeedy
Created April 29, 2019 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbeedy/c81decb3625999f75e04564d3b19b71e to your computer and use it in GitHub Desktop.
Save jamesbeedy/c81decb3625999f75e04564d3b19b71e to your computer and use it in GitHub Desktop.
snapcraft.yaml
name: pdl-api
version: '0.1'
summary: pdl-api
description: |
PDL API
grade: stable
confinement: classic
apps:
pdl-api:
daemon: simple
environment:
FLASK_APP: $SNAP/flask-app/application.py
FLASK_SECRETS: $SNAP_COMMON/flask_secrets.py
PYTHONPATH: $SNAP/lib/python3.6/site-packages/
NEW_RELIC_ENVIRONMENT: production
NEW_RELIC_CONFIG_FILE: $SNAP/flask-app/newrelic.ini
command: wrappers/pdl-api
pdl-api-revision:
command: wrappers/pdl-api-revision
nginx:
daemon: simple
plugs: [network-bind]
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8
command: wrappers/nginx-run
reload-command: wrappers/nginx-reload
parts:
pdl-api:
plugin: python
source: .
python-version: python3
requirements: requirements/newrelic-apm-requirements.txt
stage-packages:
- libpq-dev
- libssl-dev
- libjpeg-dev
- libc6-dev
- libc6
build-packages:
- libc6-dev
- libc6
prime:
- -.venv/
- -venv/
- -env/
- -zappa_settings.yaml
override-build: |
snapcraftctl build
mkdir -p $SNAPCRAFT_PART_INSTALL/flask-app
# Copy the application.py into the flask-app runtime directory
cp -r ./application.py $SNAPCRAFT_PART_INSTALL/flask-app/
# Copy the newrelic.ini into the flask-app runtime directory
cp ./local/templates/newrelic.ini $SNAPCRAFT_PART_INSTALL/flask-app/
# Write the REVISION
git rev-parse --short HEAD > $SNAPCRAFT_PART_INSTALL/flask-app/REVISION
wrappers:
after: [pdl-api]
plugin: dump
source: local/wrap/
nginx:
plugin: nginx
source: local/templates/
stage-packages:
- libc6-dev
- libc6
build-packages:
- libc6-dev
- libc6
override-build: |
snapcraftctl build
rm $SNAPCRAFT_PART_INSTALL/nginx/conf/nginx.conf.default
rm $SNAPCRAFT_PART_INSTALL/nginx/conf/nginx.conf
cp ./nginx.conf.snap.template $SNAPCRAFT_PART_INSTALL/nginx/conf/nginx.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment