Przeglądaj źródła

Add heroku config for sandbox.

master
Samir Shah 5 lat temu
rodzic
commit
6eb079b9f1
9 zmienionych plików z 46 dodań i 45 usunięć
  1. 2
    2
      Dockerfile
  2. 2
    2
      README.rst
  3. 22
    0
      app.json
  4. 1
    2
      docs/source/internals/sandbox.rst
  5. 5
    0
      heroku.yml
  6. 1
    1
      requirements.txt
  7. 2
    2
      sandbox/README.rst
  8. 9
    28
      sandbox/settings.py
  9. 2
    8
      sandbox/uwsgi.ini

+ 2
- 2
Dockerfile Wyświetl plik

@@ -1,11 +1,11 @@
1 1
 FROM python:3.5
2 2
 ENV PYTHONUNBUFFERED 1
3 3
 
4
-RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
4
+RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
5 5
 RUN apt-get install -y nodejs
6 6
 
7 7
 COPY ./requirements.txt /requirements.txt
8
-RUN pip3 install -r /requirements.txt raven==5.32.0
8
+RUN pip3 install -r /requirements.txt
9 9
 
10 10
 RUN groupadd -r django && useradd -r -g django django
11 11
 COPY . /app

+ 2
- 2
README.rst Wyświetl plik

@@ -66,7 +66,7 @@ Docs status:
66 66
 .. end-no-pypi
67 67
 
68 68
 .. _`Official homepage`: http://oscarcommerce.com
69
-.. _`Sandbox site`: http://latest.oscarcommerce.com
69
+.. _`Sandbox site`: https://latest.oscarcommerce.com
70 70
 .. _`Docker image`: https://hub.docker.com/r/oscarcommerce/django-oscar-sandbox/
71 71
 .. _`Documentation`: https://django-oscar.readthedocs.io/en/stable/
72 72
 .. _`readthedocs.org`: http://readthedocs.org
@@ -129,7 +129,7 @@ gateway page`_.
129 129
 The sandbox site can be set-up locally `in 5 commands`_.  Want to
130 130
 make changes?  Check out the `contributing guidelines`_.
131 131
 
132
-.. _`this gateway page`: http://latest.oscarcommerce.com/gateway/
132
+.. _`this gateway page`: https://latest.oscarcommerce.com/gateway/
133 133
 .. _`in 5 commands`: https://django-oscar.readthedocs.io/en/stable/internals/sandbox.html#running-the-sandbox-locally
134 134
 .. _`contributing guidelines`: https://django-oscar.readthedocs.io/en/stable/internals/contributing/index.html
135 135
 

+ 22
- 0
app.json Wyświetl plik

@@ -0,0 +1,22 @@
1
+{
2
+  "name": "django-oscar",
3
+  "description": "Django Oscar sandbox site",
4
+  "env": {
5
+    "ALLOWED_HOSTS": {
6
+      "required": true
7
+    },
8
+    "SECRET_KEY": {
9
+      "required": true
10
+    },
11
+    "SECURE_SSL_REDIRECT": {
12
+      "required": true
13
+    }
14
+  },
15
+  "formation": {
16
+    "web": {
17
+      "quantity": 1,
18
+      "size": "free"
19
+    }
20
+  },
21
+  "stack": "container"
22
+}

+ 1
- 2
docs/source/internals/sandbox.rst Wyświetl plik

@@ -35,8 +35,7 @@ The sandbox is, in effect, the blank canvas upon which you can build your site.
35 35
 Browse the external sandbox site
36 36
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 37
 
38
-An instance of the sandbox site is built hourly from master branch and made
39
-available at http://latest.oscarcommerce.com
38
+An instance of the sandbox site is made available at https://latest.oscarcommerce.com
40 39
 
41 40
 .. warning::
42 41
 

+ 5
- 0
heroku.yml Wyświetl plik

@@ -0,0 +1,5 @@
1
+build:
2
+  docker:
3
+    web: Dockerfile
4
+run:
5
+  web: uwsgi --ini uwsgi.ini --http 0:$PORT

+ 1
- 1
requirements.txt Wyświetl plik

@@ -4,7 +4,7 @@
4 4
 Werkzeug==0.15.4
5 5
 django-debug-toolbar==2.0
6 6
 django-extensions==2.2.1
7
-psycopg2>=2.7,<2.8 --no-binary psycopg2
7
+psycopg2-binary>=2.8,<2.9
8 8
 
9 9
 # Sandbox
10 10
 Pillow==6.1.0

+ 2
- 2
sandbox/README.rst Wyświetl plik

@@ -4,7 +4,7 @@ Sandbox site
4 4
 
5 5
 This site is deployed there:
6 6
 
7
-http://latest.oscarcommerce.com
7
+https://latest.oscarcommerce.com
8 8
 -------------------------------
9 9
 
10 10
 This is a vanilla install of Oscar with as little customisation as possible to
@@ -17,4 +17,4 @@ It does have a few customisations:
17 17
 * A profile model with a few fields, designed to test Oscar's account section
18 18
   which should automatically allow the profile fields to be edited.
19 19
 
20
-It is deployed automatically to: http://latest.oscarcommerce.com
20
+It is deployed automatically to: https://latest.oscarcommerce.com

+ 9
- 28
sandbox/settings.py Wyświetl plik

@@ -10,23 +10,11 @@ location = lambda x: os.path.join(
10 10
 
11 11
 DEBUG = env.bool('DEBUG', default=True)
12 12
 
13
-ALLOWED_HOSTS = [
14
-    'latest.oscarcommerce.com',
15
-    'master.oscarcommerce.com',
16
-    'localhost',
17
-    '127.0.0.1',
18
-]
13
+ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=['localhost', '127.0.0.1'])
19 14
 
20
-# This is needed for the hosted version of the sandbox
21
-ADMINS = (
22
-    ('David Winterbottom', 'david.winterbottom@gmail.com'),
23
-    ('Michael van Tellingen', 'michaelvantellingen@gmail.com'),
24
-)
25 15
 EMAIL_SUBJECT_PREFIX = '[Oscar sandbox] '
26 16
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
27 17
 
28
-MANAGERS = ADMINS
29
-
30 18
 # Use a Sqlite database by default
31 19
 DATABASES = {
32 20
     'default': {
@@ -119,7 +107,7 @@ STATICFILES_FINDERS = (
119 107
 )
120 108
 
121 109
 # Make this unique, and don't share it with anybody.
122
-SECRET_KEY = '$)a7n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
110
+SECRET_KEY = env.str('SECRET_KEY', default='UajFCuyjDKmWHe29neauXzHi9eZoRXr6RMbT5JyAdPiACBP6Cra2')
123 111
 
124 112
 TEMPLATES = [
125 113
     {
@@ -160,6 +148,7 @@ MIDDLEWARE = [
160 148
 
161 149
     'django.contrib.sessions.middleware.SessionMiddleware',
162 150
     'django.middleware.csrf.CsrfViewMiddleware',
151
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
163 152
     'django.contrib.auth.middleware.AuthenticationMiddleware',
164 153
     'django.contrib.messages.middleware.MessageMiddleware',
165 154
     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
@@ -418,20 +407,6 @@ OSCAR_ORDER_STATUS_CASCADE = {
418 407
 # on-the-fly less processor.
419 408
 OSCAR_USE_LESS = False
420 409
 
421
-
422
-# Sentry
423
-# ======
424
-
425
-if env('SENTRY_DSN', default=None):
426
-    RAVEN_CONFIG = {'dsn': env('SENTRY_DSN', default=None)}
427
-    LOGGING['handlers']['sentry'] = {
428
-        'level': 'ERROR',
429
-        'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
430
-    }
431
-    LOGGING['root']['handlers'].append('sentry')
432
-    INSTALLED_APPS.append('raven.contrib.django.raven_compat')
433
-
434
-
435 410
 # Sorl
436 411
 # ====
437 412
 
@@ -449,6 +424,12 @@ THUMBNAIL_REDIS_URL = env('THUMBNAIL_REDIS_URL', default=None)
449 424
 # in tests/config.py
450 425
 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
451 426
 
427
+# Security
428
+SECURE_SSL_REDIRECT = env.bool('SECURE_SSL_REDIRECT', default=False)
429
+SECURE_HSTS_SECONDS = env.int('SECURE_HSTS_SECONDS', default=0)
430
+SECURE_CONTENT_TYPE_NOSNIFF = True
431
+SECURE_BROWSER_XSS_FILTER = True
432
+
452 433
 # Try and import local settings which can be used to override any of the above.
453 434
 try:
454 435
     from settings_local import *

+ 2
- 8
sandbox/uwsgi.ini Wyświetl plik

@@ -6,12 +6,12 @@ http = :8080
6 6
 http-enable-proxy-protocol = 1
7 7
 http-auto-chunked = true
8 8
 http-keepalive = 75
9
-http-timeout = 75  
9
+http-timeout = 75
10 10
 
11 11
 log-x-forwarded-for = true
12 12
 
13 13
 # Handle docker stop
14
-die-on-term = 1  
14
+die-on-term = 1
15 15
 
16 16
 vacuum = 1
17 17
 master = true
@@ -31,12 +31,6 @@ harakiri-verbose = true
31 31
 
32 32
 static-map = /media=./public/media/
33 33
 
34
-# Custom headers
35
-add-header = X-Content-Type-Options: nosniff
36
-add-header = X-XSS-Protection: 1; mode=block
37
-add-header = Strict-Transport-Security: max-age=16070400
38
-add-header = Connection: Keep-Alive
39
-
40 34
 ; if the client supports gzip encoding goto to the gzipper
41 35
 route-if = contains:${HTTP_ACCEPT_ENCODING};gzip goto:_gzip
42 36
 route-run = last:

Ładowanie…
Anuluj
Zapisz