Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential NGINX static file permission errors #150

Merged
merged 3 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ you've done the setup setups in "Running Tests", etc.
Running Tests
-------------

`scos-sensor` depends on python3.6+.

Ideally, you should add a test that covers any new feature that you add. If
you've done that, then running the included test suite is the easiest way to
check that everything is working. Either way, all tests should be run after
Expand Down
13 changes: 5 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
healthcheck:
test: test ! -e /sdr_unhealthy && test ! -e /scheduler_dead
interval: 10s
timeout: 1s
timeout: 3s
retries: 1
restart: always
depends_on:
Expand Down Expand Up @@ -45,19 +45,14 @@ services:
- '8000'
volumes:
- ${REPO_ROOT}:/opt/scos-sensor
# Uncomment to see code changes by restarting docker container (without rebuilding)
# - ./src:/src:ro
# - ./gunicorn:/gunicorn:ro
# - ./entrypoints:/entrypoints:ro
# - ./scripts:/scripts:ro
cap_add:
- SYS_PTRACE
devices:
- /dev/bus/usb:/dev/bus/usb:rw
command: /entrypoints/api_entrypoint.sh

nginx:
image: nginx:1.16-alpine
image: smsntia/nginx:${DOCKER_TAG} # DOCKER_TAG will always be 'latest' for GitHub source
restart: always
ports:
- '80:80'
Expand All @@ -68,9 +63,11 @@ services:
< /etc/nginx/nginx.conf.template
> /etc/nginx/conf.d/default.conf
&& exec nginx -g 'daemon off;'"
build:
context: .
dockerfile: docker/Dockerfile-nginx
volumes:
- ./nginx/conf.template:/etc/nginx/nginx.conf.template:ro
- ./src/static:/var/www/scos-sensor/static:ro
- ${SSL_CERT_PATH}:/etc/ssl/certs/ssl-cert.pem:ro
- ${SSL_KEY_PATH}:/etc/ssl/private/ssl-cert.key:ro
environment:
Expand Down
5 changes: 5 additions & 0 deletions docker/Dockerfile-nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:1.17-alpine

RUN mkdir -p /var/www/scos-sensor/static
COPY --chown=nginx:nginx ./src/static/ /var/www/scos-sensor/static/
COPY --chown=root:root ./nginx/conf.template /etc/nginx/nginx.conf.template
11 changes: 8 additions & 3 deletions src/sensor/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

"""

from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path, re_path
from django.views.generic import RedirectView
Expand Down Expand Up @@ -51,15 +52,19 @@
# Text to put at the top of the admin index page.
admin.site.index_title = "SCOS Sensor Configuration Portal"

urlpatterns = (
urlpatterns = [
path("", RedirectView.as_view(url="/api/")),
path("admin/", admin.site.urls),
path("api/", RedirectView.as_view(url="/api/{}/".format(DEFAULT_API_VERSION))),
re_path(API_PREFIX, include(api_urlpatterns)),
path("api/auth/", include("rest_framework.urls")),
)
]

if settings.DEBUG:
import debug_toolbar

urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + list(urlpatterns)
urlpatterns = (
[path("__debug__/", include(debug_toolbar.urls))]
+ list(urlpatterns)
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
)
404 changes: 202 additions & 202 deletions src/static/admin/fonts/LICENSE.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/static/drf-yasg/redoc/redoc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/static/drf-yasg/swagger-ui-dist/swagger-ui-bundle.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/static/drf-yasg/swagger-ui-dist/swagger-ui.css

Large diffs are not rendered by default.