Skip to content

Commit

Permalink
Merge pull request #197 from ursais/bcb-add-frepple-eight
Browse files Browse the repository at this point in the history
Add frePPLe version 8 support, using frePPLe's docker image as base
  • Loading branch information
osimallen authored Aug 28, 2023
2 parents 83e8c19 + 904a1ff commit 8c58238
Show file tree
Hide file tree
Showing 9 changed files with 1,006 additions and 0 deletions.
77 changes: 77 additions & 0 deletions frepple/8/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: "2"
services:
frepple-db:
image: ursa/postgresql:latest
restart: always
environment:
- POSTGRES_DBNAME=postgres
- POSTGRES_USER=frepple
- POSTGRES_PASSWORD=frepple
- POSTGRES_DATA=/var/lib/postgresql/data/pgdata
volumes:
- "postgres-data:/var/lib/postgresql/data"

frepple-app:
build:
context: frepple
ports:
- "8080:80"
depends_on:
- frepple-db
environment:
- [email protected]
- FREPPLE_ADMIN_NAME=Open Source Integrators
- FREPPLE_SECRET_KEY=frepple-test
- FREPPLE_OPTIONS={}
- FREPPLE_CONN_MAX_AGE=60
- FREPPLE_TEST_NAME=test_frepple
- FREPPLE_LOGDIR=/var/log/frepple
- FREPPLE_SQL_ROLE=report_role
#- FREPPLE_PORT_DEFAULT=127.0.0.1:8002
- FREPPLE_LANGUAGE_CODE=en
- FREPPLE_GOOGLE_ANALYTICS=None
- FREPPLE_TIME_ZONE=UTC
- FREPPLE_SESSION_COOKIE_AGE=3600 * 24 * 3
- FREPPLE_ATTRIBUTES=[]
- FREPPLE_MAXMEMORYSIZE=None
- FREPPLE_MAXCPUTIME=None
- FREPPLE_MAXTOTALLOGFILESIZE=200
- FREPPLE_DEFAULT_USER_GROUP=None
- FREPPLE_DEFAULT_PAGESIZE=100
- FREPPLE_DEFAULT_THEME=earth
#- FREPPLE_PORT=8000
# Apps
- FREPPLE_INSTALLED_APPS_CUSTOM='freppledb.custom',
- FREPPLE_INSTALLED_APPS_FORECASTING=true
- FREPPLE_INSTALLED_APPS_INVENTORY=true
- FREPPLE_INSTALLED_APPS_ODOO=true
# PostgreSQL
- POSTGRES_DBNAME=frepple
- POSTGRES_HOST=frepple-db
- POSTGRES_USER=frepple
- POSTGRES_PASSWORD=frepple
# Email
- FREPPLE_EMAIL_USE_TLS=True
- [email protected]
- [email protected]
- [email protected]
- FREPPLE_EMAIL_HOST_PASSWORD=test
- FREPPLE_EMAIL_HOST='placeholder'
#- FREPPLE_EMAIL_PORT=465
# Selenium
- FREPPLE_SELENIUM_TESTS=chrome
- FREPPLE_SELENIUM_HEADLESS=True
# Odoo
- FREPPLE_ODOO_PASSWORD_DEFAULT=test
- FREPPLE_ODOO_PASSWORD_SCENARIO1=test
- FREPPLE_ODOO_PASSWORD_SCENARIO2=test
- FREPPLE_ODOO_PASSWORD_SCENARIO3=test
- FREPPLE_CSRF_COOKIE_SAMESITE=None
- FREPPLE_CSRF_COOKIE_SECURE=True
- FREPPLE_SESSION_COOKIE_SAMESITE=None
- FREPPLE_SESSION_COOKIE_SECURE=True


volumes:
postgres-data:

38 changes: 38 additions & 0 deletions frepple/8/frepple/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#FROM 880063853698.dkr.ecr.us-west-2.amazonaws.com/strymon-frepple:frepple-8-0-3-official
FROM ghcr.io/frepple/frepple-enterprise:8.0.3
MAINTAINER Open Source Integrators <[email protected]>


# Update the PostgreSQL client to match the server
ENV PGVERSION=14
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
&& curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt update \
&& apt install --no-install-recommends -y postgresql-client-$PGVERSION \
&& rm -f /etc/apt/sources.list.d/pgdg.list \
&& rm -rf /var/lib/apt/lists/*

# Install Dockerize in order to use the djangosettings template
ENV DOCKERIZE_VERSION v0.7.0
RUN apt-get update \
&& apt-get install -y wget \
&& wget -O - https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | tar xzf - -C /usr/local/bin \
&& apt-get autoremove -yqq --purge wget && rm -rf /var/lib/apt/lists/*

# Install python and pip to install frePPLe requirements
RUN apt-get install -y python3
RUN apt-get update && apt-get -y install python3-pip

# Copy files
COPY entrypoint.sh /
COPY templates /frepple/templates
COPY requirements.txt /frepple/requirements.txt
COPY license.xml /etc/frepple/

# Install python3 modules
RUN pip install -r /frepple/requirements.txt

# Expose FrePPLe
EXPOSE 80

ENTRYPOINT ["/entrypoint.sh"]
20 changes: 20 additions & 0 deletions frepple/8/frepple/charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
name: frepple
version: 1.0
appVersion: 8.0.3
description: FrePPLe 8
home: https://www.opensourceintegrators.com
icon: https://github.com/ursais.png?width=64
keywords:
- advanced planning system
- manufacturing
- purchasing
- distribution
- planning
- material requirement
sources:
- https://github.com/ursais/docker
maintainers:
- name: Open Source Integrators
email: [email protected]
engine: gotpl
Empty file.
9 changes: 9 additions & 0 deletions frepple/8/frepple/charts/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: frepple
adminName: frepple
adminEmail: [email protected]
secretKey: frepple
secretWebtokenKey: frepple
pgdatabase: frepple
pghost: db
pgpassword: frepple
pguser: frepple
58 changes: 58 additions & 0 deletions frepple/8/frepple/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -e

# Set default value to environment variables
export RUNNING_ENV="${RUNNING_ENV:='dev'}"

# PostgreSQL
export PGHOST="${POSTGRES_HOST:=db}"
export PGPORT="${POSTGRES_PORT:=5432}"
export PGUSER="${POSTGRES_USER:=frepple}"
export PGPASSWORD="${POSTGRES_PASSWORD:=frepple}"
export PGDATABASE="${POSTGRES_DBNAME:=false}"
export DEFAULTDB="${DEFAULTDB:=postgres}"

# Functions
function config_frepple() {
echo "Configure FrePPLe"
dockerize -template $TEMPLATES/djangosettings.py.tmpl:/etc/frepple/djangosettings.py
}

# For dockerize
export TEMPLATES=/frepple/templates
config_frepple

# Wait for database to be ready
echo "Waiting for the database to be ready"
retries=10
until pg_isready --timeout=1 "${params[@]}" >/dev/null 2>&1
do
sleep 1
((retries=retries-1))
if [ $retries -eq 0 ]
then
echo "Can't connect to PostgreSQL on $POSTGRES_HOST:$POSTGRES_PORT as user ${POSTGRES_USER:-frepple}"
exit 1
fi
done
echo "Connected to PostgreSQL on $POSTGRES_HOST:$POSTGRES_PORT as user ${POSTGRES_USER:-frepple}"

# Create and migrate the databases
frepplectl createdatabase --skip-if-exists
frepplectl migrate --noinput

# Configure Apache
grep -qxF 'ServerName' /etc/apache2/apache2.conf || echo "ServerName localhost" >> /etc/apache2/apache2.conf
rm -f /usr/local/apache2/logs/httpd.pid

# Allow custom configuration steps to be added
if [[ -d "/etc/frepple/entrypoint.d" ]]; then
/bin/run-parts --verbose "/etc/frepple/entrypoint.d"
fi

#Start apache web server
echo "Starting web server"
exec apachectl -D FOREGROUND

exit 1
1 change: 1 addition & 0 deletions frepple/8/frepple/license.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# placeholder for the frepple enterprise license
28 changes: 28 additions & 0 deletions frepple/8/frepple/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cheroot == 8.4.5
portend == 2.5
djangorestframework == 3.13.1
djangorestframework-bulk == 0.2.1
djangorestframework-filters == 0.10.2
django-bootstrap3 == 15.0.0
django-filter == 2.4.0
html5lib == 1.0.1
jdcal == 1.4.1
Markdown == 3.1.1
openpyxl == 3.0.9
lxml == 4.9.2
PyJWT == 2.4.0
urllib3 < 2
requests == 2.31.0
python-dateutil == 2.8.1
pillow >= 8.4.0
psutil == 5.7.3
psycopg2-binary == 2.8.6
# Python packaging is broken on ubuntu 20 for higher versions of setuptools
setuptools <= 46.1
setuptools-rust == 0.12.1
pysftp == 0.2.9
channels == 4.0.0
attrs == 23.1.0
daphne == 4.0.0
Twisted[tls,http2]
https://github.com/frePPLe/django/tarball/frepple_8.0
Loading

1 comment on commit 8c58238

@jdetaeye
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just peeking at your docker image :-)

Looks all cool and nice. A small remark: A separate requirements.txt is no longer needed on recent frepple versions (>7.0). The docker image and debian installer package all python dependencies already in a virtual env folder. We removed that burden from the installation.
Keeping it in your script isn't needed, but doesn't cause any harm either.

Please sign in to comment.