* refractor: removed modules from user.context * refractor: removed cycles from user context * refractor: removed state from user context * feat: implement channel protocol for tracking issue-activites * refactor: remove blocking code and add todo * refactor: refactor the consumer with function modules * feat: add columns for identifiers for easier redirection * style: minor padding, coloring and consistency changes * feat: track blocker issues * feat: track issue after creation * feat: add runworker in procfile * refractor: moved all context provider to _app for more clarity * dev: added our icons * refractor: removed issues from user context * refactor: rename db names to plural and remove admin register file * refactor: integrate permission layer in endpoints * feat: create product email html templates * refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring * feat: remirror added * feat: workspace member user details endpoint * fix: resolved build issue * refactor: remove www * feat: workspace details on user endpoint * feat: added authorization in project settings refractor: improved code readability * fix: removed hard-coded workspace slug value, and added workspace in user interface * refactor: invitation workflow for already existing users * feat: modified remirror, fix: issue details sidebar * fix: merge conflicts * fix: merge conflicts * fix: added missing dependencies * refactor: remove user dependency from invitations * refactor: issue description context is updated with manager * dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable * chore: upgrade python package requirements * dev: added new migrations for changes * dev: ssl config for django channels redis connection * chore: upgrade channels requirements * refactor: better function for connecting with redis ssl django channels * chore: cleanup on manifest file * revert: user endpoint changes * build: setup asgi * refactor: update invitation endpoint to do bulk operations * style: cycles page, custom listbox, issue details page * refractor: removed folder that were moved to workspaceSlug * dev: uvicorn in requirements * Update index.tsx * refactor: get workspace slug on user endpoint * fix: workspace slug redirections and slug value in user context * fix: user context bugs, drag and drop in cycles and modules * fix: merge conflicts * fix: user context and create issue modal * refactor: add extra columns for json and html description and script for back migrating old issues * refactor: move all 500 errors to 400 * refractor: removed active project, active workspace, projects, and workspaces from user context * refractor: change from /home to /, added home page redirection logic added explict GET method on fetch request, and fixed invitation page not fetching all invitations * fix: passing project id in command palette * style: home page, feat: image in remirror * fix: bugs * chore: remove test_runner workflow from github actions * dev: update Procfile worker count and python runtime upgrade * refactor: update response from 404 to 403 * feat: filtering using both name and issue identifier in command palette showing my issues instead of project issue in command palette, hiding again according to route in command palette * fix: mutation on different CRUD operations * fix: redirection in my issues pages * feat: added authorization in workspace settings, moved command palette to app-layout * feat: endpoint and column to store my issue props * style: authorization new design, fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page * feat: return project details on modules and cycles * fix: create cycle and state coming below issue modal, showing loader for rich text editor refractor: changed from sprint to cycle in issue type * fix: issue delete mustation and some code refractor * fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons * feat: user role in model * dev: added new migrations * fix: add url for workspace availability check * feat: onboarding screens * fix: update url for workspace name check and add authentication layer and fix invitation endpoint * refactor: bulk invitations message * refactor: response on workspace invitarions * refactor: update identifier endpoint * refactor: invitations endpoint * feat: onboarding logic and validations * fix: email striep * dev: added workspace space member unique_together * chore: back populate neccesary data for description field * feat: emoji-picker gets close on select, public will be default option in create project * fix: update error in project creation * fix: mutation error on issue count in kanban view some minor code refractoring * fix: module bugs * fix: issue activities and issue comments mutation handled at issue detail * fix: error message for creating updates without permissions * fix: showing no user left to invite in project invite fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation * refactor: file asset upload directory * fix: update last workspace id on user invitation accept * style: onboarding screens * style: cycles, issue activity * feat: add json and html column in issue comments * fix: submitting create issue modal on enter click, project not getting deselected * feat: file size validator * fix: emoji picker not closing on all emoji select * feat: added validation in identifier such that it only accept uppercase text * dev: commenting is now richer * fix: shortcuts not getting opened in settings layouts * style: showing sidebar on unauthorized pages * fix: error code on exception * fix: add issue button is working on my issues pages * feat: new way of assets * fix: updated activity content for description field * fix: mutation on project settings control style: blocker and blocked changed to outline button * fix: description activity logging * refactor: check for workspace slug on workspace creation * fix: typo on workspace url check * fix: workspace name uniqueness * fix: remove workspace from read only field * fix: file upload endpoint, workspace slug check * chore: drop unique_together constraint for name and workspace * chore: settings files cleanup and use PubSub backend on django channels * chore: change in channels backend * refactor: issue activity api to combine comments * fix: instance created at key * fix: result list * style: create project, cycle modal, view dropdown * feat: merged issue activities and issue comments into a single section * fix: remirror dynamic update of issue description * fix: removed commented code * fix: issue acitivties mutation * fix: empty comments cant be submitted * fix: workspace avatar has been updated while loading * refactor: update docker-compose to run redis and database in heroku and docker environment * refactor: removesingle docker file configuration * refactor: update take off script to run in asgi * docs: added workspace, quickstart documentation * fix: reading editor values on focus out * refactor: cleanup environment variables and create .env.example * refactor: add extra variables in example env * fix: warning and erros on console lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence * feat: env examples * fix: workspace member does not exist * fi: remove pagination from issue list api * refactor: remove env example from root * feat: documentation for projects on plane * feat: create code of conduct and contributing guidelines * fix: update docker setup to check handle redis * revert: bring back pagination to avoid breaking * feat: made image uploader modal, used it in profile page and workspace page, delete project from project settings page, join project modal in project list page * feat: create workspace page, style: made ui consistent * style: updated onboarding and create workspace page design * style: responsive sidebar * fix: updated ui imports
249 lines
7.5 KiB
Python
249 lines
7.5 KiB
Python
"""Production settings and globals."""
|
|
import ssl
|
|
from typing import Optional
|
|
from urllib.parse import urlparse
|
|
|
|
import dj_database_url
|
|
from urllib.parse import urlparse
|
|
from redis.asyncio.connection import Connection, RedisSSLContext
|
|
|
|
import sentry_sdk
|
|
from sentry_sdk.integrations.django import DjangoIntegration
|
|
from sentry_sdk.integrations.redis import RedisIntegration
|
|
|
|
from .common import * # noqa
|
|
|
|
# Database
|
|
DEBUG = False
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
|
"NAME": "plane",
|
|
"USER": os.environ.get("PGUSER"),
|
|
"PASSWORD": os.environ.get("PGPASSWORD"),
|
|
"HOST": os.environ.get("PGHOST"),
|
|
}
|
|
}
|
|
|
|
# CORS WHITELIST ON PROD
|
|
CORS_ORIGIN_WHITELIST = [
|
|
# "https://example.com",
|
|
# "https://sub.example.com",
|
|
# "http://localhost:8080",
|
|
# "http://127.0.0.1:9000"
|
|
]
|
|
# Parse database configuration from $DATABASE_URL
|
|
DATABASES["default"] = dj_database_url.config()
|
|
SITE_ID = 1
|
|
|
|
# Enable Connection Pooling (if desired)
|
|
# DATABASES['default']['ENGINE'] = 'django_postgrespool'
|
|
|
|
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
|
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
|
|
|
# Allow all host headers
|
|
ALLOWED_HOSTS = ["*"]
|
|
|
|
# TODO: Make it FALSE and LIST DOMAINS IN FULL PROD.
|
|
CORS_ALLOW_ALL_ORIGINS = True
|
|
|
|
# Simplified static file serving.
|
|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
|
|
|
|
|
sentry_sdk.init(
|
|
dsn=os.environ.get("SENTRY_DSN"),
|
|
integrations=[DjangoIntegration(), RedisIntegration()],
|
|
# If you wish to associate users to errors (assuming you are using
|
|
# django.contrib.auth) you may enable sending PII data.
|
|
traces_sample_rate=1,
|
|
send_default_pii=True,
|
|
environment="production",
|
|
)
|
|
|
|
# The AWS region to connect to.
|
|
AWS_REGION = os.environ.get("AWS_REGION")
|
|
|
|
# The AWS access key to use.
|
|
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID")
|
|
|
|
# The AWS secret access key to use.
|
|
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY")
|
|
|
|
# The optional AWS session token to use.
|
|
# AWS_SESSION_TOKEN = ""
|
|
|
|
|
|
# The name of the bucket to store files in.
|
|
AWS_S3_BUCKET_NAME = os.environ.get("AWS_S3_BUCKET_NAME")
|
|
|
|
# How to construct S3 URLs ("auto", "path", "virtual").
|
|
AWS_S3_ADDRESSING_STYLE = "auto"
|
|
|
|
# The full URL to the S3 endpoint. Leave blank to use the default region URL.
|
|
AWS_S3_ENDPOINT_URL = ""
|
|
|
|
# A prefix to be applied to every stored file. This will be joined to every filename using the "/" separator.
|
|
AWS_S3_KEY_PREFIX = ""
|
|
|
|
# Whether to enable authentication for stored files. If True, then generated URLs will include an authentication
|
|
# token valid for `AWS_S3_MAX_AGE_SECONDS`. If False, then generated URLs will not include an authentication token,
|
|
# and their permissions will be set to "public-read".
|
|
AWS_S3_BUCKET_AUTH = False
|
|
|
|
# How long generated URLs are valid for. This affects the expiry of authentication tokens if `AWS_S3_BUCKET_AUTH`
|
|
# is True. It also affects the "Cache-Control" header of the files.
|
|
# Important: Changing this setting will not affect existing files.
|
|
AWS_S3_MAX_AGE_SECONDS = 60 * 60 # 1 hours.
|
|
|
|
# A URL prefix to be used for generated URLs. This is useful if your bucket is served through a CDN. This setting
|
|
# cannot be used with `AWS_S3_BUCKET_AUTH`.
|
|
AWS_S3_PUBLIC_URL = ""
|
|
|
|
# If True, then files will be stored with reduced redundancy. Check the S3 documentation and make sure you
|
|
# understand the consequences before enabling.
|
|
# Important: Changing this setting will not affect existing files.
|
|
AWS_S3_REDUCED_REDUNDANCY = False
|
|
|
|
# The Content-Disposition header used when the file is downloaded. This can be a string, or a function taking a
|
|
# single `name` argument.
|
|
# Important: Changing this setting will not affect existing files.
|
|
AWS_S3_CONTENT_DISPOSITION = ""
|
|
|
|
# The Content-Language header used when the file is downloaded. This can be a string, or a function taking a
|
|
# single `name` argument.
|
|
# Important: Changing this setting will not affect existing files.
|
|
AWS_S3_CONTENT_LANGUAGE = ""
|
|
|
|
# A mapping of custom metadata for each file. Each value can be a string, or a function taking a
|
|
# single `name` argument.
|
|
# Important: Changing this setting will not affect existing files.
|
|
AWS_S3_METADATA = {}
|
|
|
|
# If True, then files will be stored using AES256 server-side encryption.
|
|
# If this is a string value (e.g., "aws:kms"), that encryption type will be used.
|
|
# Otherwise, server-side encryption is not be enabled.
|
|
# Important: Changing this setting will not affect existing files.
|
|
AWS_S3_ENCRYPT_KEY = False
|
|
|
|
# The AWS S3 KMS encryption key ID (the `SSEKMSKeyId` parameter) is set from this string if present.
|
|
# This is only relevant if AWS S3 KMS server-side encryption is enabled (above).
|
|
# AWS_S3_KMS_ENCRYPTION_KEY_ID = ""
|
|
|
|
# If True, then text files will be stored using gzip content encoding. Files will only be gzipped if their
|
|
# compressed size is smaller than their uncompressed size.
|
|
# Important: Changing this setting will not affect existing files.
|
|
AWS_S3_GZIP = True
|
|
|
|
# The signature version to use for S3 requests.
|
|
AWS_S3_SIGNATURE_VERSION = None
|
|
|
|
# If True, then files with the same name will overwrite each other. By default it's set to False to have
|
|
# extra characters appended.
|
|
AWS_S3_FILE_OVERWRITE = False
|
|
|
|
# AWS Settings End
|
|
|
|
|
|
# Enable Connection Pooling (if desired)
|
|
# DATABASES['default']['ENGINE'] = 'django_postgrespool'
|
|
|
|
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
|
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
|
|
|
# Allow all host headers
|
|
ALLOWED_HOSTS = [
|
|
"*",
|
|
]
|
|
|
|
|
|
DEFAULT_FILE_STORAGE = "django_s3_storage.storage.S3Storage"
|
|
# Simplified static file serving.
|
|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
|
|
|
SESSION_COOKIE_SECURE = True
|
|
CSRF_COOKIE_SECURE = True
|
|
|
|
|
|
REDIS_URL = os.environ.get("REDIS_URL")
|
|
|
|
CACHES = {
|
|
"default": {
|
|
"BACKEND": "django_redis.cache.RedisCache",
|
|
"LOCATION": REDIS_URL,
|
|
"OPTIONS": {
|
|
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
|
"CONNECTION_POOL_KWARGS": {"ssl_cert_reqs": False},
|
|
},
|
|
}
|
|
}
|
|
|
|
RQ_QUEUES = {
|
|
"default": {
|
|
"USE_REDIS_CACHE": "default",
|
|
}
|
|
}
|
|
|
|
|
|
class CustomSSLConnection(Connection):
|
|
def __init__(
|
|
self,
|
|
ssl_context: Optional[str] = None,
|
|
**kwargs,
|
|
):
|
|
super().__init__(**kwargs)
|
|
self.ssl_context = RedisSSLContext(ssl_context)
|
|
|
|
|
|
class RedisSSLContext:
|
|
__slots__ = ("context",)
|
|
|
|
def __init__(
|
|
self,
|
|
ssl_context,
|
|
):
|
|
self.context = ssl_context
|
|
|
|
def get(self):
|
|
return self.context
|
|
|
|
|
|
url = urlparse(os.environ.get("REDIS_URL"))
|
|
|
|
DOCKERIZED = os.environ.get("DOCKERIZED", False) # Set the variable true if running in docker-compose environment
|
|
|
|
if not DOCKERIZED:
|
|
|
|
ssl_context = ssl.SSLContext()
|
|
ssl_context.check_hostname = False
|
|
|
|
CHANNEL_LAYERS = {
|
|
"default": {
|
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
|
"CONFIG": {
|
|
"hosts": [
|
|
{
|
|
"host": url.hostname,
|
|
"port": url.port,
|
|
"username": url.username,
|
|
"password": url.password,
|
|
"connection_class": CustomSSLConnection,
|
|
"ssl_context": ssl_context,
|
|
}
|
|
],
|
|
},
|
|
},
|
|
}
|
|
|
|
CHANNEL_LAYERS = {
|
|
"default": {
|
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
|
"CONFIG": {
|
|
"hosts": [(os.environ.get("REDIS_URL"))],
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
WEB_URL = os.environ.get("WEB_URL")
|