mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	Add postgresql database
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -2,4 +2,5 @@ data_dev.sqlite
 | 
				
			|||||||
migrations
 | 
					migrations
 | 
				
			||||||
venv
 | 
					venv
 | 
				
			||||||
.env
 | 
					.env
 | 
				
			||||||
 | 
					.env_database
 | 
				
			||||||
__pycache__
 | 
					__pycache__
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										14
									
								
								config.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								config.py
									
									
									
									
									
								
							@@ -24,8 +24,16 @@ class Config:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class DevelopmentConfig(Config):
 | 
					class DevelopmentConfig(Config):
 | 
				
			||||||
    DEBUG = True
 | 
					    DEBUG = True
 | 
				
			||||||
    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir,
 | 
					    # SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir,
 | 
				
			||||||
                                                          'data_dev.sqlite')
 | 
					    #                                                       'data_dev.sqlite')
 | 
				
			||||||
 | 
					    SQLALCHEMY_DATABASE_URI = \
 | 
				
			||||||
 | 
					        'postgresql+psycopg2://{user}:{passwd}@{host}:{port}/{db}'.format(
 | 
				
			||||||
 | 
					            user=os.environ.get('POSTGRES_USER'),
 | 
				
			||||||
 | 
					            passwd=os.environ.get('POSTGRES_PASSWORD'),
 | 
				
			||||||
 | 
					            host=os.environ.get('POSTGRES_HOST'),
 | 
				
			||||||
 | 
					            port=os.environ.get('POSTGRES_PORT'),
 | 
				
			||||||
 | 
					            db=os.environ.get('POSTGRES_DB_NAME'))
 | 
				
			||||||
 | 
					    print(SQLALCHEMY_DATABASE_URI)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestingConfig(Config):
 | 
					class TestingConfig(Config):
 | 
				
			||||||
@@ -41,7 +49,7 @@ class TestingConfig(Config):
 | 
				
			|||||||
config = {
 | 
					config = {
 | 
				
			||||||
    'development': DevelopmentConfig,
 | 
					    'development': DevelopmentConfig,
 | 
				
			||||||
    'testing': TestingConfig,
 | 
					    'testing': TestingConfig,
 | 
				
			||||||
    # 'production': ProductionConfig,
 | 
					    #'production': ProductionConfig,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'default': DevelopmentConfig
 | 
					    'default': DevelopmentConfig
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,12 +3,40 @@ version: '3.7'
 | 
				
			|||||||
services:
 | 
					services:
 | 
				
			||||||
  web:
 | 
					  web:
 | 
				
			||||||
    build: .
 | 
					    build: .
 | 
				
			||||||
    container_name: web_flask_opaque
 | 
					    container_name: opaque_flask
 | 
				
			||||||
    image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque
 | 
					    image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - .:/opaque
 | 
					      - .:/opaque
 | 
				
			||||||
 | 
					      - $HOME/opaque_test:/home/compute/mnt/opaque
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
 | 
					      - .env_database
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - 5000:5000
 | 
					      - 5000:5000
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      - db
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - db
 | 
				
			||||||
    command: bash flask-entrypoint.sh
 | 
					    command: bash flask-entrypoint.sh
 | 
				
			||||||
 | 
					  daemon:
 | 
				
			||||||
 | 
					    container_name: opaque_daemon
 | 
				
			||||||
 | 
					    image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/daemon_opaque
 | 
				
			||||||
 | 
					    network_mode: "host"
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - /home/stephan/Repos/own/opaque/data_dev.sqlite:/daemon/db/data_dev.sqlite
 | 
				
			||||||
 | 
					      - $HOME/.docker/config.json:/root/.docker/config.json
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      - db
 | 
				
			||||||
 | 
					  db:
 | 
				
			||||||
 | 
					    container_name: opaque_db
 | 
				
			||||||
 | 
					    image: postgres:11.5
 | 
				
			||||||
 | 
					    env_file:
 | 
				
			||||||
 | 
					      - .env_database
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 5432:5432
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - postgres_data:/var/lib/postgresql/data
 | 
				
			||||||
 | 
					    restart: always
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					volumes:
 | 
				
			||||||
 | 
					  postgres_data:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,5 +8,6 @@ Flask-SQLAlchemy
 | 
				
			|||||||
Flask-Table
 | 
					Flask-Table
 | 
				
			||||||
Flask-WTF
 | 
					Flask-WTF
 | 
				
			||||||
jsonpatch
 | 
					jsonpatch
 | 
				
			||||||
 | 
					psycopg2
 | 
				
			||||||
python-dotenv
 | 
					python-dotenv
 | 
				
			||||||
redis
 | 
					redis
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user