diff --git a/README.md b/README.md index 68a5b03..574b402 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ git clone https://github.com/mediacms-io/mediacms cd mediacms ``` -The default option to serve MediaCMS is on http://localhost. If you want to set a url and have it served there, set the `FRONTEND_HOST` variable on file `deploy/docker/local_settings.py`. +The default option is to serve MediaCMS on all ips available of the server (including localhost). Now run @@ -95,7 +95,7 @@ Now run docker-compose up ``` -This will download all MediaCMS related Docker images and start all containers. Once it finishes, MediaCMS will be installed and available on http://localhost (or the url you've set as `FRONTEND_HOST` on file `deploy/docker/local_settings.py`) +This will download all MediaCMS related Docker images and start all containers. Once it finishes, MediaCMS will be installed and available on http://localhost or http://ip For more instructions, checkout the docs on the [Docker deployment](docs/Docker_deployment.md) page. Docker Compose support has been contributed by @swiftugandan. diff --git a/cms/settings.py b/cms/settings.py index 82fd4f4..675c135 100644 --- a/cms/settings.py +++ b/cms/settings.py @@ -42,7 +42,11 @@ ALLOW_RATINGS_CONFIRMED_EMAIL_ONLY = True # ip of the server should be part of this ALLOWED_HOSTS = ["*", "mediacms.io", "127.0.0.1", "localhost"] + FRONTEND_HOST = "http://localhost" +# this variable - along with SSL_FRONTEND_HOST is used on several places +# as email where a URL need appear etc + # FRONTEND_HOST needs an http prefix - at the end of the file # there's a conversion to https with the SSL_FRONTEND_HOST env INTERNAL_IPS = "127.0.0.1" diff --git a/deploy/local_install/mediacms.io b/deploy/local_install/mediacms.io index 106cc33..59c75de 100644 --- a/deploy/local_install/mediacms.io +++ b/deploy/local_install/mediacms.io @@ -7,15 +7,15 @@ server { error_log /var/log/nginx/mediacms.io.error.log warn; - # redirect to https if logged in - if ($http_cookie ~* "sessionid") { - rewrite ^/(.*)$ https://localhost/$1 permanent; - } +# # redirect to https if logged in +# if ($http_cookie ~* "sessionid") { +# rewrite ^/(.*)$ https://localhost/$1 permanent; +# } - # redirect basic forms to https - location ~ (login|login_form|register|mail_password_form)$ { - rewrite ^/(.*)$ https://localhost/$1 permanent; - } +# # redirect basic forms to https +# location ~ (login|login_form|register|mail_password_form)$ { +# rewrite ^/(.*)$ https://localhost/$1 permanent; +# } location /static { alias /home/mediacms.io/mediacms/static ; diff --git a/docs/Docker_deployment.md b/docs/Docker_deployment.md index 551043f..13ba32c 100644 --- a/docs/Docker_deployment.md +++ b/docs/Docker_deployment.md @@ -37,4 +37,4 @@ The reverse proxy (`jwilder/nginx-proxy`) can be configured to provide SSL termi The architecture below generalises all the deployment scenarios above, and provides a conceptual design for other deployments based on kubernetes and docker swarm. It allows for horizontal scaleability through the use of multiple mediacms_web instances and celery_workers. For large deployments, managed postgres, redis and storage may be adopted. -![MediaCMS](images/architecture.png) \ No newline at end of file +![MediaCMS](images/architecture.png) diff --git a/files/context_processors.py b/files/context_processors.py index d11aa1d..f9297f5 100644 --- a/files/context_processors.py +++ b/files/context_processors.py @@ -5,12 +5,7 @@ from .methods import is_mediacms_editor, is_mediacms_manager def stuff(request): """Pass settings to the frontend""" ret = {} - if request.is_secure(): - # in case session is https, pass this setting so - # that the frontend uses https too - ret["FRONTEND_HOST"] = settings.SSL_FRONTEND_HOST - else: - ret["FRONTEND_HOST"] = settings.FRONTEND_HOST + ret["FRONTEND_HOST"] = request.build_absolute_uri('/') ret["DEFAULT_THEME"] = settings.DEFAULT_THEME ret["PORTAL_NAME"] = settings.PORTAL_NAME ret["LOAD_FROM_CDN"] = settings.LOAD_FROM_CDN diff --git a/templates/config/core/url.html b/templates/config/core/url.html index d0e3050..a478ea3 100644 --- a/templates/config/core/url.html +++ b/templates/config/core/url.html @@ -1,37 +1,37 @@ -MediaCMS.url = { - home: "{{FRONTEND_HOST}}", - search: "{{FRONTEND_HOST}}/search", - latestMedia: "{{FRONTEND_HOST}}/latest", - featuredMedia: "{{FRONTEND_HOST}}/featured", - recommendedMedia: "{{FRONTEND_HOST}}/recommended", - members: "{{FRONTEND_HOST}}/members", - /* Error pages */ - error404: "{{FRONTEND_HOST}}/error", - /* Taxonomies pages */ - tags: "{{FRONTEND_HOST}}/tags", - categories: "{{FRONTEND_HOST}}/categories", - topics: "{{FRONTEND_HOST}}/topics", - languages: "{{FRONTEND_HOST}}/languages", - countries: "{{FRONTEND_HOST}}/countries", - /* User pages */ - likedMedia: "{{FRONTEND_HOST}}/liked", - history: "{{FRONTEND_HOST}}/history", - /* Add/edit pages */ - addMedia: "{{FRONTEND_HOST}}/upload", - /* User account pages */ - editProfile: "{{user.edit_url}}", - {% if request.user.is_authenticated %} - signout: "{{FRONTEND_HOST}}/accounts/logout/", - editChannel: "{{user.default_channel_edit_url}}", - changePassword: "{{FRONTEND_HOST}}/accounts/password/change/", - /* Administration pages */ - {% if IS_MEDIACMS_ADMIN %}admin: '/admin',{% endif %} - /* Management pages */ - {% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER or IS_MEDIACMS_EDITOR %}manageMedia: "{{FRONTEND_HOST}}/manage/media",{% endif %} - {% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER %}manageUsers: "{{FRONTEND_HOST}}/manage/users",{% endif %} - {% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER or IS_MEDIACMS_EDITOR %}manageComments: "{{FRONTEND_HOST}}/manage/comments",{% endif %} - {% else %} - signin: "{{FRONTEND_HOST}}/accounts/login/", - register: "{{FRONTEND_HOST}}/accounts/signup/", - {% endif %} -}; +MediaCMS.url = { + home: "/", + search: "/search", + latestMedia: "/latest", + featuredMedia: "/featured", + recommendedMedia: "/recommended", + members: "/members", + /* Error pages */ + error404: "/error", + /* Taxonomies pages */ + tags: "/tags", + categories: "/categories", + topics: "/topics", + languages: "/languages", + countries: "/countries", + /* User pages */ + likedMedia: "/liked", + history: "/history", + /* Add/edit pages */ + addMedia: "/upload", + /* User account pages */ + editProfile: "{{user.edit_url}}", + {% if request.user.is_authenticated %} + signout: "/accounts/logout/", + editChannel: "{{user.default_channel_edit_url}}", + changePassword: "/accounts/password/change/", + /* Administration pages */ + {% if IS_MEDIACMS_ADMIN %}admin: '/admin',{% endif %} + /* Management pages */ + {% if IS_MEDIACMS_EDITOR %}manageMedia: "/manage/media",{% endif %} + {% if IS_MEDIACMS_MANAGER %}manageUsers: "/manage/users",{% endif %} + {% if IS_MEDIACMS_EDITOR %}manageComments: "/manage/comments",{% endif %} + {% else %} + signin: "/accounts/login/", + register: "/accounts/signup/", + {% endif %} +}; diff --git a/templates/config/installation/site.html b/templates/config/installation/site.html index 984d88d..be5333b 100644 --- a/templates/config/installation/site.html +++ b/templates/config/installation/site.html @@ -1,8 +1,8 @@ MediaCMS.site = { id: 'mediacms', title: "{{PORTAL_NAME}}", - url: '{{FRONTEND_HOST}}/', - api: '{{FRONTEND_HOST}}/api/v1', + url: '{{FRONTEND_HOST}}', + api: '{{FRONTEND_HOST}}api/v1', theme: { mode: 'light', // Valid values: 'light', 'dark'. switch: { @@ -11,12 +11,12 @@ MediaCMS.site = { }, logo:{ lightMode:{ - img: "{{FRONTEND_HOST}}/static/images/logo_dark.png", - svg: "{{FRONTEND_HOST}}/static/images/logo_dark.svg", + img: "/static/images/logo_dark.png", + svg: "/static/images/logo_dark.svg", }, darkMode:{ - img: "{{FRONTEND_HOST}}/static/images/logo_light.png", - svg: "{{FRONTEND_HOST}}/static/images/logo_light.svg", + img: "/static/images/logo_light.png", + svg: "/static/images/logo_light.svg", }, }, pages: { @@ -49,4 +49,5 @@ MediaCMS.site = { title: 'Categories', }, }, -}; \ No newline at end of file +}; +