Skip to content

Commit

Permalink
fix pg8000 issue switch to psycopg2
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-ssd authored and Sida Say committed May 13, 2022
1 parent b4c5cb7 commit 2a67621
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ ENV LISTEN_PORT 80

ENV PI_SKIP_BOOTSTRAP=false \
DB_VENDOR=sqlite \
PI_VERSION=3.7 \
PI_VERSION=3.7.1 \
PI_HOME=/opt/privacyidea

ENV VIRTUAL_ENV=/opt/privacyidea
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install wheel && \
pip install supervisor uwsgi pymysql-sa PyMySQL pg8000 && \
pip install supervisor uwsgi pymysql-sa PyMySQL psycopg2-binary && \
pip install -r https://raw.githubusercontent.com/privacyidea/privacyidea/v${PI_VERSION}/requirements.txt && \
pip install git+https://github.com/privacyidea/privacyidea.git@v${PI_VERSION}

Expand Down
26 changes: 26 additions & 0 deletions docker-compose-posgresql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '2.1'

services:
postgresql:
image: 'docker.io/bitnami/postgresql:14'
ports:
- '5432:5432'
environment:
- POSTGRESQL_DATABASE=privacyidea
- POSTGRESQL_USERNAME=privacyidea
- POSTGRESQL_PASSWORD=privacyidea
privacyidea:
image: 'docker.io/khalibre/privacyidea:dev'
ports:
- '80:80'
environment:
- DB_VENDOR=postgresql
- DB_NAME=privacyidea
- DB_HOST=postgresql
- DB_USER=privacyidea
- DB_PASSWORD=privacyidea
- SECRET_KEY=suppersecretkey
- PI_PEPPER=secretworduseforadminencrypt
- PI_PAGE_TITLE=pivacyIDEA
depends_on:
- postgresql
2 changes: 1 addition & 1 deletion scripts/start_privacyidea.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function prestart_privacyidea {
[ -z "$DB_NAME" ] && echo "DB_NAME should be defined" && return 1
export SQLALCHEMY_DATABASE_URI=pymysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}
elif { [ "${DB_VENDOR}" = "postgresql" ]; } then
export SQLALCHEMY_DATABASE_URI=postgresql+pg8000://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}
export SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}
else
echo "DB_VENDOR enviroment varaible is not set. Using default SQLite..."
fi
Expand Down

0 comments on commit 2a67621

Please sign in to comment.