-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add micka for dev & test, test CSW Transaction Insert
- Loading branch information
Showing
25 changed files
with
589 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# connection parameters to PostgreSQL database | ||
PG_HOST=postgresql | ||
PG_PORT=5432 | ||
PG_DBNAME=hsrs_micka6 | ||
PG_USER=docker | ||
PG_PASSWORD=docker | ||
PG_TEMPLATE_DBNAME=template_postgis | ||
|
||
INIT_SQL_FILE_PATHS=/var/www/html/Micka/php/install/2_create_table.sql,/var/www/html/Micka/php/install/3_insert_data_basic.sql,/var/www/html/Micka/php/install/4_insert_standard_schema.sql,/var/www/html/Micka/php/install/5_insert_profiles.sql,/var/www/html/Micka/php/install/6_00_label_eng.sql,/var/www/html/Micka/php/install/6_01_label_cze.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import os | ||
import sys | ||
import time | ||
|
||
ATTEMPT_INTERVAL = 2 | ||
MAX_ATTEMPTS = 60 | ||
|
||
|
||
PG_HOST = os.environ['PG_HOST'] | ||
PG_PORT = os.environ['PG_PORT'] | ||
PG_DBNAME = os.environ['PG_DBNAME'] | ||
PG_USER = os.environ['PG_USER'] | ||
PG_PASSWORD = os.environ['PG_PASSWORD'] | ||
PG_CONN = { | ||
'host': PG_HOST, | ||
'port': PG_PORT, | ||
'dbname': PG_DBNAME, | ||
'user': PG_USER, | ||
'password': PG_PASSWORD, | ||
} | ||
PG_TEMPLATE_DBNAME = os.environ['PG_TEMPLATE_DBNAME'] | ||
INIT_SQL_FILE_PATHS = os.environ['INIT_SQL_FILE_PATHS'].split(',') | ||
|
||
|
||
|
||
def main(): | ||
|
||
attempt = 1 | ||
|
||
# PostgreSQL (try to connect to default 'postgres' database | ||
pg_conn_dict = PG_CONN.copy() | ||
pg_conn_dict['dbname'] = 'postgres' | ||
secret_conn_dict = {k: v for k, v in pg_conn_dict.items() if k != 'password'} | ||
wait_for_msg = f"PostgreSQL database, {secret_conn_dict}" | ||
print(f"Waiting for {wait_for_msg}") | ||
while True: | ||
import psycopg2 | ||
try: | ||
with psycopg2.connect(**pg_conn_dict) as conn: | ||
pass | ||
print(f"Attempt {attempt}/{MAX_ATTEMPTS} successful.") | ||
break | ||
except psycopg2.OperationalError as e: | ||
handle_exception(e, attempt, wait_for_msg) | ||
attempt += 1 | ||
print() | ||
|
||
|
||
|
||
micka_conn_dict = PG_CONN.copy() | ||
dbname = micka_conn_dict['dbname'] | ||
print(f"Checking existence of {dbname} database") | ||
|
||
try: | ||
with psycopg2.connect(**micka_conn_dict): | ||
pass | ||
print(f"Database {dbname} exists.") | ||
except psycopg2.OperationalError as e: | ||
print(f"Database {dbname} does not exist, creating") | ||
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT | ||
with psycopg2.connect(**pg_conn_dict) as pg_conn: | ||
pg_conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) | ||
cur = pg_conn.cursor() | ||
cur.execute(f"CREATE DATABASE {dbname} WITH TEMPLATE={PG_TEMPLATE_DBNAME} ENCODING='UTF8' CONNECTION LIMIT=-1;") | ||
cur.close() | ||
print(f"Database {dbname} created") | ||
with psycopg2.connect(**micka_conn_dict) as micka_conn: | ||
cur = micka_conn.cursor() | ||
for init_sql_file_path in INIT_SQL_FILE_PATHS: | ||
print(f"Running SQL file {init_sql_file_path}") | ||
cur.execute(open(init_sql_file_path, "r", encoding="utf-8").read()) | ||
cur.close() | ||
|
||
|
||
def handle_exception(e, attempt, wait_for_msg=None): | ||
if attempt < MAX_ATTEMPTS: | ||
msg_end = f"Waiting {ATTEMPT_INTERVAL} seconds before next attempt." | ||
else: | ||
msg_end = "Max attempts reached!" | ||
# print(f"Attempt {attempt}/{MAX_ATTEMPTS} failed:") | ||
# print(e) | ||
# print(msg_end) | ||
# traceback.print_exc() | ||
if attempt >= MAX_ATTEMPTS: | ||
print(f"Reaching max attempts when waiting for {wait_for_msg}") | ||
sys.exit(1) | ||
# raise e | ||
time.sleep(ATTEMPT_INTERVAL) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
parameters: | ||
app: | ||
# UI theme | ||
layoutTheme = default | ||
# UI langauges (must have translation files) | ||
langs = 'eng,cze' | ||
# dafult profile used | ||
startProfil = 5 | ||
#records per page | ||
maxRecords = 10 | ||
#max number of records per page | ||
limitMaxRecords = 100 | ||
#default sort | ||
sortBy = 'title,ASC' | ||
importReport = FALSE | ||
#switch the validator | ||
validator = TRUE | ||
directSummary = TRUE | ||
directDetail = TRUE | ||
directXml = TRUE | ||
formSign = FALSE | ||
defaultEditGroup = editor | ||
defaultViewGroup = reader | ||
# record indication for access from csw etc. | ||
mdDataType = "-1=>'semifinished',0=>'private',1=>'public',2=>'portal'" | ||
# admin IP list | ||
adminIP = '127.0.0.1' | ||
# web proxy address | ||
proxy = | ||
map: | ||
# initial map extent | ||
hs_initext = 12.0 48.5 18.9 51 | ||
# address of the connected WMS viewer web app | ||
viewerURL = "https://geoportal.gov.cz/web/guest/map" | ||
contact: | ||
#contact info used in Capabilities document etc. | ||
title: | ||
cze = "Katalog prostorových metadat." | ||
eng = "Spatial Metadata Catalogue." | ||
abstract: | ||
eng = "Catalogue based on OGC Catalogue service 2.0.2 ISO AP 1.0" | ||
cze = "Katalog prostorových metadat podle OGC CSW 2.0.2 ISO AP 1.0" | ||
org: | ||
eng = "Your company name" | ||
cze = "Název vaší organizace" | ||
person = "Your name" | ||
position: | ||
eng = "Responsible preson" | ||
cze = "Zodpovědná osoba" | ||
email = "" | ||
delivery = "your delivery point" | ||
city = "" | ||
postcode = "" | ||
phone = "" | ||
www = "" | ||
langCodes: | ||
cs: cze | ||
da: dan | ||
de: ger | ||
en: eng | ||
es: spa | ||
fi: fin | ||
fr: fre | ||
hu: hun | ||
it: ita | ||
lv: lav | ||
no: nor | ||
pl: pol | ||
pt: por | ||
sk: slo | ||
sl: slv | ||
sv: swe | ||
|
||
database: | ||
dsn: 'pgsql:host=postgresql;dbname=hsrs_micka6;port=5432' | ||
user: 'docker' | ||
password: 'docker' | ||
debugger: false | ||
options: | ||
lazy: yes | ||
|
||
translation: | ||
default: en | ||
fallback: [cs] | ||
resolvers: | ||
header: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
## | ||
# You should look at the following URL's in order to grasp a solid understanding | ||
# of Nginx configuration files in order to fully unleash the power of Nginx. | ||
# https://www.nginx.com/resources/wiki/start/ | ||
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ | ||
# https://wiki.debian.org/Nginx/DirectoryStructure | ||
# | ||
# In most cases, administrators will remove this file from sites-enabled/ and | ||
# leave it as reference inside of sites-available where it will continue to be | ||
# updated by the nginx packaging team. | ||
# | ||
# This file will automatically load configuration files provided by other | ||
# applications, such as Drupal or Wordpress. These applications will be made | ||
# available underneath a path with that package name, such as /drupal8. | ||
# | ||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. | ||
## | ||
|
||
# Default server configuration | ||
# | ||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
|
||
# SSL configuration | ||
# | ||
# listen 443 ssl default_server; | ||
# listen [::]:443 ssl default_server; | ||
# | ||
# Note: You should disable gzip for SSL traffic. | ||
# See: https://bugs.debian.org/773332 | ||
# | ||
# Read up on ssl_ciphers to ensure a secure configuration. | ||
# See: https://bugs.debian.org/765782 | ||
# | ||
# Self signed certs generated by the ssl-cert package | ||
# Don't use them in a production server! | ||
# | ||
# include snippets/snakeoil.conf; | ||
|
||
root /var/www/html/Micka; | ||
|
||
# Add index.php to the list if you are using PHP | ||
index index.html index.htm index.nginx-debian.html; | ||
|
||
server_name _; | ||
|
||
#location / { | ||
# # First attempt to serve request as file, then | ||
# # as directory, then fall back to displaying a 404. | ||
# try_files $uri $uri/ =404; | ||
#} | ||
|
||
location / { | ||
try_files $uri /index.php$is_args$args; | ||
|
||
location ~ /(.*\.php)(/.*)?$ { | ||
include snippets/fastcgi-php.conf; | ||
fastcgi_pass unix:/run/php/php5.6-fpm.sock; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
} | ||
|
||
# pass PHP scripts to FastCGI server | ||
# | ||
#location ~ \.php$ { | ||
# include snippets/fastcgi-php.conf; | ||
# | ||
# # With php-fpm (or other unix sockets): | ||
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | ||
# # With php-cgi (or other tcp sockets): | ||
# fastcgi_pass 127.0.0.1:9000; | ||
#} | ||
|
||
# deny access to .htaccess files, if Apache's document root | ||
# concurs with nginx's one | ||
# | ||
#location ~ /\.ht { | ||
# deny all; | ||
#} | ||
} | ||
|
||
|
||
# Virtual Host configuration for example.com | ||
# | ||
# You can move that to a different file under sites-available/ and symlink that | ||
# to sites-enabled/ to enable it. | ||
# | ||
#server { | ||
# listen 80; | ||
# listen [::]:80; | ||
# | ||
# server_name example.com; | ||
# | ||
# root /var/www/example.com; | ||
# index index.html; | ||
# | ||
# location / { | ||
# try_files $uri $uri/ =404; | ||
# } | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ services: | |
- redis | ||
- postgresql | ||
- geoserver | ||
- micka | ||
|
||
hslayers: | ||
container_name: hslayers | ||
|
Oops, something went wrong.