Skip to content

Commit

Permalink
Add koalixcrm application files and update settings
Browse files Browse the repository at this point in the history
The koalixcrm application files have been added, along with the configuration settings for  production. The settings have been tailored to cover Django base settings and customized for the specific requirements of the koalixcrm project. Additionally, the instructions and data for the Docker container setup have also been updated for production deployment.
  • Loading branch information
scaphilo committed Apr 6, 2024
1 parent 502a4f8 commit e5a57c3
Show file tree
Hide file tree
Showing 10 changed files with 518 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ RUN apt-get update && apt-get install -y \

WORKDIR /usr/src/app

COPY koalixcrm /usr/src/app/koalixcrm

# Install dependencies
RUN pip install --upgrade pip
COPY requirements.txt /usr/src/app/
Expand All @@ -33,4 +35,4 @@ ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
EXPOSE 8000

# Command to run the Django development server
CMD python manage.py migrate && gunicorn --bind :8000 koalixcrm.wsgi
CMD python manage.py koalixcrm/migrate && gunicorn --bind :8000 wsgi
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
# koalixcrm-prod-container
In this repo we define and build the kaolixcrm prod container
# Koalix CRM Production Docker Container

This repository contains the Docker configuration for creating a production-ready container for the Koalix CRM system.
The Koalix CRM is a small and easy-to-use Customer Relationship Management system, including a basic Accounting Software.

This Docker container is configured with all necessary dependencies and settings, allowing for the rapid deployment of
the Koalix CRM in a production environment.

## Installation

Before you start, you need both Docker and Docker Compose installed on your system. Docker Compose comes pre-installed
with Docker for Mac and Windows, but for Linux, you need to install it separately after Docker.

For Windows and Mac users, you can download Docker Desktop from
[Docker's official website](https://www.docker.com/products/docker-desktop).
For Linux users, instructions vary by distribution. Docker's official website provides detailed instructions
for [Ubuntu](https://docs.docker.com/engine/install/ubuntu/), [Debian](https://docs.docker.com/engine/install/debian/),
[Fedora](https://docs.docker.com/engine/install/fedora/), and [CentOS](https://docs.docker.com/engine/install/centos/).

## Configuration

Download the `docker-compose.yaml` file from this repository and place it in a directory where you'd like to run the
Koalix CRM container.

Before running the containers, adjust a few environment variables in the `docker-compose.yaml` file:

- `DJANGO_SECRET_KEY`: A secret key for a particular Django installation. This is used to provide cryptographic signing,
- and should be set to a unique, unpredictable value.
- `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`: These are the root username, password, and the database name that
- PostgreSQL will set up at its launch.

Replace the placeholders with actual values.

## Running the Application

Open a terminal and navigate (`cd`) to the directory containing the `docker-compose.yaml` file. Use the following
command to download all the required images:

docker-compose pull
After the images are downloaded, launch the application using:

docker-compose up

The application should then be accessible at `http://localhost:8000`, or the HOST and PORT you specified.

## Audience

This repository is intended for DevOps engineers, software developers, or IT administrators who need to deploy
Koalix CRM in a production environment quickly and efficiently.

## Feedback

We welcome your feedback and contributions! Please submit issues or pull requests if you have improvements
or find problems.
Empty file added koalixcrm/__init__.py
Empty file.
21 changes: 21 additions & 0 deletions koalixcrm/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
Empty file added koalixcrm/settings/__init__.py
Empty file.
123 changes: 123 additions & 0 deletions koalixcrm/settings/base_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
"""
Django base settings for koalixcrm project.
"""

import os

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

# Application definition
PREREQUISITE_APPS = [
'django.contrib.contenttypes',
'grappelli.dashboard',
'grappelli',
'filebrowser',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'django_filters'
]

PROJECT_APPS = [
'koalixcrm.crm',
'koalixcrm.accounting',
'koalixcrm.djangoUserExtension',
'koalixcrm.subscriptions',
]

INSTALLED_APPS = PREREQUISITE_APPS + PROJECT_APPS

KOALIXCRM_PLUGINS = (
'koalixcrm.subscriptions',
)

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'koalixcrm.crm.middleware.timezoneMiddleware.TimezoneMiddleware',
]

ROOT_URLCONF = 'settings.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'settings.wsgi.application'


# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR)

PROJECT_ROOT = BASE_DIR

# Settings specific for koalixcrm
PDF_OUTPUT_ROOT = os.path.join(STATIC_ROOT, 'pdf')

# Settings specific for filebrowser
FILEBROWSER_DIRECTORY = 'media/uploads/'
FILEBROWSER_EXTENSIONS = {
'XML': ['.xml'],
'XSL': ['.xsl'],
'JPG': ['.jpg'],
'PNG': ['.png'],
'GIF': ['.gif'],
'TTF': ['.ttf'],
}

LOGIN_URL = "/admin/login"

REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
)
}
Loading

0 comments on commit e5a57c3

Please sign in to comment.