Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add postgresql support #36

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ LABEL org.opencontainers.image.vendor="Authkeys" \
org.opencontainers.image.source="https://github.com/theoapp/theo-node" \
org.opencontainers.image.title="Theo Server" \
org.opencontainers.image.description="The authorized keys manager" \
org.opencontainers.image.version="1.3.0" \
org.opencontainers.image.version="1.4.0-beta.0" \
org.opencontainers.image.documentation="https://theoapp.readthedocs.io" \
org.opencontainers.image.licenses='Apache-2.0'
28 changes: 28 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.1"

services:
postgres:
image: postgres:14
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- ./data/postgres:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
profiles:
- postgres
mariadb:
image: mariadb:10.6
environment:
MYSQL_ROOT_PASSWORD: secretRootPassword
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- ./data/mariadb:/var/lib/mysql
ports:
- "127.0.0.1:3306:3306"
profiles:
- mariadb
68 changes: 68 additions & 0 deletions docker-compose/docker-compose-test-postgres-redis-core-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
version: '3.1'

services:
db:
image: ${POSTGRES_IMAGE}
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
cache:
image: ${REDIS_IMAGE}
theo1:
image: theo:test
container_name: theo1
environment:
MODE: test
DB_ENGINE: postgres
DB_HOST: db
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${POSTGRES_DB}
CORE_TOKEN: ${CORE_TOKEN}
CACHE_ENABLED: redis
CACHE_URI: redis://cache:6379
CLUSTER_MODE: 1
DB_CONN_MAX_RETRY: 30
SKIP_UPDATECHECK: 1
depends_on:
- cache
- db
theo2:
image: theo:test
container_name: theo2
environment:
MODE: test
DB_ENGINE: postgres
DB_HOST: db
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${POSTGRES_DB}
CORE_TOKEN: ${CORE_TOKEN}
CACHE_ENABLED: redis
CACHE_URI: redis://cache:6379
CLUSTER_MODE: 1
DB_CONN_MAX_RETRY: 30
SKIP_UPDATECHECK: 1
depends_on:
- cache
- db
theo3:
image: theo:test
container_name: theo3
environment:
MODE: test
DB_ENGINE: postgres
DB_HOST: db
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${POSTGRES_DB}
CORE_TOKEN: ${CORE_TOKEN}
CACHE_ENABLED: redis
CACHE_URI: redis://cache:6379
CLUSTER_MODE: 1
DB_CONN_MAX_RETRY: 30
SKIP_UPDATECHECK: 1
depends_on:
- cache
- db
30 changes: 30 additions & 0 deletions docker-compose/docker-compose-test-postgres-redis-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3.1'

services:
db:
image: ${POSTGRES_IMAGE}
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
cache:
image: ${REDIS_IMAGE}
theo:
image: theo:test
container_name: theo1
environment:
MODE: test
DB_ENGINE: postgres
DB_HOST: db
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${POSTGRES_DB}
CORE_TOKEN: ${CORE_TOKEN}
CACHE_ENABLED: redis
CACHE_URI: redis://cache:6379
CLUSTER_MODE: 1
DB_CONN_MAX_RETRY: 30
SKIP_UPDATECHECK: 1
depends_on:
- cache
- db
30 changes: 30 additions & 0 deletions docker-compose/docker-compose-test-postgres-redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3.1'

services:
db:
image: ${POSTGRES_IMAGE}
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
cache:
image: ${REDIS_IMAGE}
theo:
image: theo:test
container_name: theo
environment:
MODE: test
DB_ENGINE: postgres
DB_HOST: db
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${POSTGRES_DB}
ADMIN_TOKEN: ${ADMIN_TOKEN}
CLIENT_TOKENS: ${CLIENT_TOKENS}
CACHE_ENABLED: redis
CACHE_URI: redis://cache:6379
DB_CONN_MAX_RETRY: 30
SKIP_UPDATECHECK: 1
depends_on:
- cache
- db
25 changes: 25 additions & 0 deletions docker-compose/docker-compose-test-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.1'

services:
db:
image: ${POSTGRES_IMAGE}
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
theo:
image: theo:test
container_name: theo
environment:
MODE: test
DB_ENGINE: postgres
DB_HOST: db
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${POSTGRES_DB}
ADMIN_TOKEN: ${ADMIN_TOKEN}
CLIENT_TOKENS: ${CLIENT_TOKENS}
DB_CONN_MAX_RETRY: 30
SKIP_UPDATECHECK: 1
depends_on:
- db
12 changes: 10 additions & 2 deletions docker-compose/test_env
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# docker images
export MARIADB_IMAGE=mariadb:10.5
export MARIADB_IMAGE=mariadb:10.6
export MYSQLSERVER_IMAGE=mysql/mysql-server:8.0
export REDIS_IMAGE=redis:6.0
export POSTGRES_IMAGE=postgres:14
export REDIS_IMAGE=redis:6
export MEMCACHED_IMAGE=memcached:1-alpine

# mariadb/mysql
Expand All @@ -18,3 +19,10 @@ export CLIENT_TOKENS=njknsjd2412fnjkasnj,knkjnknfjfnjenkln

export ADMIN_TOKEN_AUDIT=jjkfsdbb23
export ADMIN_TOKENS_AUDIT=4getm3N0t:admin1,n0t4ever:admin2,jjkfsdbb23:admin3


# Postgres

export POSTGRES_DB=theo
export POSTGRES_USER=theouser
export POSTGRES_PASSWORD=theopwd
Loading