building postgres

This commit is contained in:
Rafał Jaworski 2019-05-16 14:54:14 +02:00
parent 8cfc22d1fb
commit 5b16bf4695
6 changed files with 80 additions and 15 deletions

View File

@ -0,0 +1,55 @@
DROP TABLE IF EXISTS tm;
CREATE TABLE tm (
id SERIAL PRIMARY KEY,
source_lang_id integer,
target_lang_id integer,
name varchar(40),
lemmatized bool DEFAULT false
);
DROP TABLE IF EXISTS request;
CREATE TABLE request (
id SERIAL PRIMARY KEY,
source_file_path varchar(100),
target_file_path varchar(100),
source_lang_id integer,
target_lang_id integer,
name varchar(40),
status integer,
type integer,
tm_id integer,
created timestamp default now()
);
DROP TABLE IF EXISTS language;
CREATE TABLE language (
id SERIAL PRIMARY KEY,
code varchar(10),
name varchar(30)
);
DROP TABLE IF EXISTS unit;
CREATE TABLE unit (
id SERIAL PRIMARY KEY,
tm_id integer,
source_id integer,
source_segment text,
target_segment text,
source_tokens integer[],
target_tokens integer[],
alignments text
);
CREATE INDEX ON unit(tm_id);
CREATE INDEX ON unit(source_id);
DROP TABLE IF EXISTS source;
CREATE TABLE source (
id SERIAL PRIMARY KEY,
external_id integer,
name text,
link text
);
CREATE INDEX ON source(external_id);

View File

@ -0,0 +1,6 @@
INSERT INTO language(code, name) VALUES ('pl', 'Polish');
INSERT INTO language(code, name) VALUES ('en', 'English');
INSERT INTO language(code, name) VALUES ('de', 'German');
INSERT INTO language(code, name) VALUES ('es', 'Spanish');
INSERT INTO language(code, name) VALUES ('it', 'Italian');
INSERT INTO language(code, name) VALUES ('hr', 'Croatian');

View File

@ -0,0 +1,8 @@
FROM library/postgres
ENV POSTGRES_USER concordia
ENV POSTGRES_PASSWORD concordia
ENV POSTGRES_DB concordia_db
COPY 00_concordia_db.sql /docker-entrypoint-initdb.d/
COPY 01_lang.sql /docker-entrypoint-initdb.d/

View File

@ -10,6 +10,5 @@ RUN cd concordia-server && mkdir build && cd build && ../cmake.sh && make
COPY fcgi_concordia /etc/nginx/sites-available
RUN rm /etc/nginx/sites-enabled/default
RUN ln -s /etc/nginx/sites-available/fcgi_concordia /etc/nginx/sites-enabled/fcgi_concordia
RUN /usr/sbin/nginx -g "daemon on;"
#CMD concordia-server/scripts/start.sh
CMD /usr/sbin/nginx -g "daemon on;" && sleep 4 && concordia-server/scripts/simplestart.sh

View File

@ -3,22 +3,15 @@ version: '3.1'
services:
concordia-postgres:
image: postgres
build: ./concordia-postgres
container_name: concordia-postgres
restart: always
ports:
- "10001:5432"
environment:
POSTGRES_USER: webuser
POSTGRES_PASSWORD: webpassword
POSTGRES_DB: backend_db
concordia-server:
build: ./concordia-server
container_name: concordia-server
ports:
- "10002:80"
lemmagen:
build: ./lemmagen
container_name: lemmagen
restart: always
concordia-server:
build: ./concordia-server
container_name: concordia-server
ports:
- "10001:80"

4
getContainerBash.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
sudo docker start $1
sudo docker exec -it $1 /bin/bash