Skip to content

Commit 6b293a4

Browse files
committed
various install fixes
1 parent 49592bd commit 6b293a4

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ COPY docker_autostart.sh /usr/local/bin/init_textpair_db
1414
COPY textpair /textpair/textpair
1515

1616
RUN apt update && apt install -y postgresql postgresql-contrib curl git locales libpq-dev python3-pip sudo ripgrep liblz4-tool && curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash && apt-get install -y nodejs && apt-get clean && rm -rf /var/lib/apt && cd /textpair && ./install.sh && mkdir -p /var/www/html/text-pair && echo "[WEB_APP]\nweb_app_path = /var/www/html/text-pair\napi_server = http://localhost/text-pair-api\n[DATABASE]\ndatabase_name = textpair\ndatabase_user = textpair\ndatabase_password = textpair" > /etc/text-pair/global_settings.ini && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
17+
RUN mkdir /etc/philologic && echo 'database_root = "/var/www/html/philologic"\nurl_root = "http://localhost/philologic/"\nweb_app_dir = "/var/lib/philologic4/web_app/"' > /etc/philologic/philologic4.cfg
18+
19+
USER postgres
20+
RUN service postgresql start && sleep 5 && \
21+
psql --command "CREATE DATABASE textpair;" && \
22+
psql --command "CREATE ROLE textpair WITH LOGIN PASSWORD 'textpair';" && \
23+
psql --command "GRANT ALL PRIVILEGES ON DATABASE textpair TO textpair;" && \
24+
psql -d textpair --command "CREATE EXTENSION pg_trgm;" && \
25+
perl -pi -e 's/^(local.*)peer$/$1 md5/;' /etc/postgresql/14/main/pg_hba.conf
26+
27+
USER root
1728
ENV LANG en_US.UTF-8
1829
ENV LANGUAGE en_US:en
1930
ENV LC_ALL en_US.UTF-8

api_server/web_server.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CERTFILE=
1313

1414
if [ -z "$KEYFILE" ]
1515
then
16-
gunicorn -k uvicorn.workers.UvicornWorker -b :$PORT -w 4 --access-logfile=/var/lib/text-pair/api_server/access.log --error-logfile=/var/lib/text-pair/api_server/error.log --chdir /var/lib/text-pair/api/ text_pair:app
16+
/var/lib/text-pair/textpair_env/bin/gunicorn -k uvicorn.workers.UvicornWorker -b :$PORT -w 4 --access-logfile=/var/lib/text-pair/api_server/access.log --error-logfile=/var/lib/text-pair/api_server/error.log --chdir /var/lib/text-pair/api/ text_pair:app
1717
else
18-
gunicorn --keyfile=$KEYFILE --certfile=$CERTFILE -k uvicorn.workers.UvicornWorker -b :$PORT -w 4 --access-logfile=/var/lib/text-pair/api_server/access.log --error-logfile=/var/lib/text-pair/api_server/error.log --chdir /var/lib/text-pair/api/ text_pair:app
18+
/var/lib/text-pair/textpair_env/bin/gunicorn --keyfile=$KEYFILE --certfile=$CERTFILE -k uvicorn.workers.UvicornWorker -b :$PORT -w 4 --access-logfile=/var/lib/text-pair/api_server/access.log --error-logfile=/var/lib/text-pair/api_server/error.log --chdir /var/lib/text-pair/api/ text_pair:app
1919
fi

docker_autostart.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/bin/bash
22
# Copied to docker container and run as command
33

4-
if [ ! -d "/data/psql_data" ]; then
5-
su postgres <<'EOF'
6-
service postgresql start
7-
psql -c "create database textpair"
8-
psql -d textpair -c "create extension pg_trgm;"
9-
psql -c "create role textpair with login password 'textpair';"
10-
psql -c "GRANT ALL PRIVILEGES ON database textpair to textpair;"
11-
EOF
12-
perl -pi -e 's/^(local.*)peer$/$1 md5/;' /etc/postgresql/14/main/pg_hba.conf
4+
# if [ ! -d "/data/psql_data" ]; then
5+
# su postgres <<'EOF'
6+
# service postgresql start
7+
# psql -c "create database textpair"
8+
# psql -d textpair -c "create extension pg_trgm;"
9+
# psql -c "create role textpair with login password 'textpair';"
10+
# psql -c "GRANT ALL PRIVILEGES ON database textpair to textpair;"
11+
# EOF
12+
# perl -pi -e 's/^(local.*)peer$/$1 md5/;' /etc/postgresql/14/main/pg_hba.conf
1313
su postgres <<'EOF'
1414
service postgresql restart
1515
EOF

lib/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"sentence-transformers",
1616
"lz4",
1717
"orjson",
18-
"text_preprocessing @ git+https://github.com/ARTFL-Project/text-preprocessing@v1.0.5#egg=text_preprocessing",
18+
"text_preprocessing @ git+https://github.com/ARTFL-Project/text-preprocessing@v1.1.0.1#egg=text_preprocessing",
1919
"fastapi==0.110.3",
2020
"psycopg2",
2121
"gunicorn",

textpair

100644100755
File mode changed.

0 commit comments

Comments
 (0)