haiwen / ccnet-server

Internal communication framework and user/group management for Seafile server
Other
17 stars 36 forks source link

PostgeSQL support #50

Closed demian-ionov closed 4 years ago

demian-ionov commented 4 years ago

Support PostgeSQL server.

Need use connection pooler!

Example:

pgbouncer.ini

pool_mode = session
server_reset_query = DISCARD ALL

ccnet.conf

[Database]
ENGINE=pgsql
DB=ccnet_db
USER=seafile
PASSWD=secret
HOST=127.0.0.1
# UNIX_SOCKET=/run/postgresql
PORT=6432

seafile.conf

[database]
type=pgsql
db_name=seafile_db
user=seafile
password=seacret
host=127.0.0.1
# unix_socket=/run/postgresql
port=6432

seahub_settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'seahub_db',
        'USER': 'seafile',
        'PASSWORD': 'secret',
        'HOST': '127.0.0.1',
        # 'HOST': '/run/postgresql',
        'PORT': '6432'
    }
}

Django syncdb:

export INSTALLPATH=/opt/seafile/seafile-server-latest
export CCNET_CONF_DIR=/opt/seafile/conf
export SEAFILE_CONF_DIR=/opt/seafile/conf
export SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf
export PYTHONPATH=${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
python ${INSTALLPATH}/seahub/manage.py migrate --run-syncdb