forked from kaldi-asr/kaldi
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from Skaiste/server-docker
Server docker
- Loading branch information
Showing
15 changed files
with
262 additions
and
20 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
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,76 @@ | ||
FROM centos:7 | ||
|
||
ENV CPU_CORE 4 | ||
|
||
# Activate systemd. Taken from https://hub.docker.com/_/centos | ||
ENV container docker | ||
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ | ||
systemd-tmpfiles-setup.service ] || rm -f $i; done); \ | ||
rm -f /lib/systemd/system/multi-user.target.wants/*;\ | ||
rm -f /etc/systemd/system/*.wants/*;\ | ||
rm -f /lib/systemd/system/local-fs.target.wants/*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ | ||
rm -f /lib/systemd/system/basic.target.wants/*;\ | ||
rm -f /lib/systemd/system/anaconda.target.wants/*; | ||
VOLUME [ "/sys/fs/cgroup" ] | ||
|
||
RUN yum update -y | ||
RUN yum groupinstall -y "Development Tools" "System Tools" | ||
RUN yum install -y \ | ||
git bzip2 wget subversion which sox \ | ||
gcc-c++ make automake autoconf zlib-devel atlas-static \ | ||
python python3-devel cmake tcsh pcre-devel | ||
RUN yum remove -y swig | ||
RUN yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/swig3-3.0.12-17.el7.x86_64.rpm | ||
|
||
# install cuda | ||
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm dkms | ||
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-repo-rhel7-10.0.130-1.x86_64.rpm | ||
RUN rpm -i cuda-repo-*.rpm | ||
RUN yum install -y cuda | ||
|
||
WORKDIR /usr/local/ | ||
# Use the newest idlak version | ||
RUN git clone https://github.com/Idlak/idlak.git | ||
WORKDIR /usr/local/idlak | ||
RUN git checkout server-docker | ||
RUN git pull | ||
|
||
WORKDIR /usr/local/idlak/tools | ||
RUN mkdir python | ||
RUN touch python/.use_default_python | ||
RUN extras/check_dependencies.sh | ||
RUN make -j $CPU_CORE | ||
RUN ./install_idlak.sh | ||
|
||
WORKDIR /usr/local/idlak/src | ||
ENV SWIG=/usr/bin/swig | ||
RUN ./configure --shared --cudatk-dir=/usr/local/cuda-10.2/ | ||
RUN make clean | ||
RUN make depend -j $CPU_CORE | ||
RUN make -j $CPU_CORE | ||
RUN make ext -j $CPU_CORE | ||
|
||
WORKDIR /usr/local/idlak/idlak-server | ||
RUN python3 -m pip install -r requirements.txt | ||
|
||
EXPOSE 80 | ||
|
||
# setup nginx | ||
RUN yum install -y epel-release | ||
RUN yum install -y nginx | ||
|
||
# setup idlak service | ||
RUN cp docker/wsgi.ini ./. | ||
RUN cp docker/idlak.service /etc/systemd/system/. | ||
RUN cp docker/idlak.conf /etc/nginx/conf.d/idlak.conf | ||
RUN systemctl enable idlak | ||
|
||
# continue setting up nginx | ||
RUN usermod -a -G root nginx | ||
RUN chmod 710 /usr/local/idlak | ||
RUN systemctl enable nginx | ||
|
||
CMD ["/usr/sbin/init"] | ||
|
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,70 @@ | ||
FROM centos:7 | ||
|
||
ENV CPU_CORE 4 | ||
|
||
# Activate systemd. Taken from https://hub.docker.com/_/centos | ||
ENV container docker | ||
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ | ||
systemd-tmpfiles-setup.service ] || rm -f $i; done); \ | ||
rm -f /lib/systemd/system/multi-user.target.wants/*;\ | ||
rm -f /etc/systemd/system/*.wants/*;\ | ||
rm -f /lib/systemd/system/local-fs.target.wants/*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ | ||
rm -f /lib/systemd/system/basic.target.wants/*;\ | ||
rm -f /lib/systemd/system/anaconda.target.wants/*; | ||
VOLUME [ "/sys/fs/cgroup" ] | ||
|
||
RUN yum update -y | ||
RUN yum groupinstall -y "Development Tools" "System Tools" | ||
RUN yum install -y \ | ||
git bzip2 wget subversion which sox \ | ||
gcc-c++ make automake autoconf zlib-devel atlas-static \ | ||
python python3-devel cmake tcsh pcre-devel | ||
RUN yum remove -y swig | ||
RUN yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/swig3-3.0.12-17.el7.x86_64.rpm | ||
|
||
WORKDIR /usr/local/ | ||
# Use the newest idlak version | ||
RUN git clone https://github.com/Idlak/idlak.git | ||
WORKDIR /usr/local/idlak | ||
RUN git checkout server-docker | ||
RUN git pull | ||
|
||
WORKDIR /usr/local/idlak/tools | ||
RUN mkdir python | ||
RUN touch python/.use_default_python | ||
RUN extras/check_dependencies.sh | ||
RUN make -j $CPU_CORE | ||
RUN ./install_idlak.sh | ||
|
||
WORKDIR /usr/local/idlak/src | ||
ENV SWIG=/usr/bin/swig | ||
RUN ./configure --shared | ||
RUN make clean | ||
RUN make depend -j $CPU_CORE | ||
RUN make -j $CPU_CORE | ||
RUN make ext -j $CPU_CORE | ||
|
||
WORKDIR /usr/local/idlak/idlak-server | ||
RUN python3 -m pip install -r requirements.txt | ||
|
||
EXPOSE 80 | ||
|
||
# setup nginx | ||
RUN yum install -y epel-release | ||
RUN yum install -y nginx | ||
|
||
# setup idlak service | ||
RUN cp docker/wsgi.ini ./. | ||
RUN cp docker/idlak.service /etc/systemd/system/. | ||
RUN cp docker/idlak.conf /etc/nginx/conf.d/idlak.conf | ||
RUN systemctl enable idlak | ||
|
||
# continue setting up nginx | ||
RUN usermod -a -G root nginx | ||
RUN chmod 710 /usr/local/idlak | ||
RUN systemctl enable nginx | ||
|
||
CMD ["/usr/sbin/init"] | ||
|
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 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
include uwsgi_params; | ||
uwsgi_pass unix:/usr/local/idlak/idlak-server/idlak-wsgi.sock; | ||
} | ||
} |
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,12 @@ | ||
[Unit] | ||
Description=uWSGI instance to serve Idlak REST API server | ||
After=network.target | ||
|
||
[Service] | ||
User=root | ||
Group=nginx | ||
WorkingDirectory=/usr/local/idlak/idlak-server | ||
ExecStart=/usr/local/bin/uwsgi --ini wsgi.ini | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,15 @@ | ||
[uwsgi] | ||
module = runserver | ||
callable = app | ||
|
||
master = true | ||
processes = 5 | ||
|
||
socket = idlak-wsgi.sock | ||
chmod-socket = 660 | ||
vacuum = true | ||
|
||
die-on-term = true | ||
|
||
req-logger = file:/usr/local/idlak/idlak-server/access.log | ||
logger = file:/usr/local/idlak/idlak-server/error.log |
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 |
---|---|---|
|
@@ -11,3 +11,4 @@ python-pcre==0.7 | |
requests==2.21.0 | ||
SQLAlchemy==1.2.10 | ||
Werkzeug==0.14.1 | ||
uwsgi==2.0.18 |
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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
import os | ||
from app import create_app | ||
|
||
app = create_app('config.ini') | ||
cdir = os.path.split(os.path.abspath(__file__))[0] | ||
|
||
config_fn = os.path.join(cdir, 'config.ini') | ||
|
||
app = create_app(config_fn) | ||
|
||
if __name__ == '__main__': | ||
app.run() | ||
app.run(host=app.config["HOST"], port=app.config["PORT"]) | ||
else: | ||
application = app |
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 |
---|---|---|
@@ -1,14 +1,11 @@ | ||
#!/bin/bash | ||
set -v | ||
TOREPLACE="from pip import main" | ||
REPLACETO="from pip._internal import main" | ||
|
||
echo "virtualenv venv" | ||
virtualenv venv | ||
echo "source venv/bin/activate" | ||
virtualenv -p python3 venv | ||
source venv/bin/activate | ||
echo "replace \"$TOREPLACE\" \"$REPLACETO\" -- venv/bin/pip3" | ||
replace "$TOREPLACE" "$REPLACETO" -- venv/bin/pip3 | ||
echo "venv/bin/pip3 install -r requirements.txt" | ||
venv/bin/pip3 install -r requirements.txt | ||
echo "export FLASK_APP=runserver.py" | ||
venv/bin/python3 -m pip install -r requirements.txt | ||
export FLASK_APP=runserver.py | ||
set +v |
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,20 @@ | ||
{ | ||
"voices": [ | ||
{ | ||
"name": "en_ga_slt", | ||
"gender": "female", | ||
"lang": "en", | ||
"acc": "ga", | ||
"vid": "slt", | ||
"dir": "../idlak-voices/tangle/en/ga/slt" | ||
}, | ||
{ | ||
"name": "ro_ro_bas", | ||
"gender": "female", | ||
"lang": "ro", | ||
"acc": "ro", | ||
"vid": "bas", | ||
"dir": "../idlak-voices/tangle/ro/ro/bas" | ||
} | ||
] | ||
} |