главная|main page

состояние|status

блог|blog

файлы|files

программы|software

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--nginx2
-rwxr-xr-xrun.sh11
-rwxr-xr-xsetup.sh17
4 files changed, 22 insertions, 15 deletions
diff --git a/README.md b/README.md
index 18802c6..f951875 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,6 @@ Run LibreTranslate on Ubuntu 20.04.
Uses [LibreTranslate WSGI](https://community.libretranslate.com/t/is-wsgi-currently-supported/24/3) with [Gunicorn and Nginx](https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04).
```
-
# Add argosopentech user
useradd argosopentech
mkdir /home/argosopentech
@@ -21,6 +20,12 @@ sudo swapon --show
# Download and run LibreTranslate-init
git clone https://github.com/argosopentech/LibreTranslate-init.git ~/LibreTranslate-init
+
+# Run LibreTranslate on port 5000
~/LibreTranslate-init/setup.sh
+# Run LibreTranslate WSGI with nginx and systemd
+~/LibreTranslate-init/run.sh
+
```
+
diff --git a/nginx b/nginx
index dc4ffff..9c007a8 100644
--- a/nginx
+++ b/nginx
@@ -1,6 +1,6 @@
server {
listen 80;
- server_name localhost translate.argosopentech.com;
+ server_name localhost;
location / {
include proxy_params;
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..4af2e93
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,11 @@
+# Setup systemd
+sudo cp ~/LibreTranslate-init/libretranslate.service /etc/systemd/system/
+sudo systemctl start libretranslate
+sudo systemctl enable libretranslate
+# sudo systemctl status libretranslate
+
+# Configure Nginx
+sudo cp ~/LibreTranslate-init/nginx /etc/nginx/sites-available/default
+sudo nginx -t
+sudo systemctl restart nginx
+
diff --git a/setup.sh b/setup.sh
index 4126227..8743017 100755
--- a/setup.sh
+++ b/setup.sh
@@ -13,25 +13,16 @@ sudo apt-get install -y libicu-dev python3-icu pkg-config
sudo apt-get install -y nginx
# Download LibreTranslate source
-git clone https://github.com/argosopentech/LibreTranslate.git ~/LibreTranslate
+git clone https://github.com/LibreTranslate/LibreTranslate.git ~/LibreTranslate
# Setup virtualenv
virtualenv ~/LibreTranslate/env
source ~/LibreTranslate/env/bin/activate
-# Install LibreTranslate
-pip install -e ~/LibreTranslate/
-
# Install gunicorn
pip install gunicorn
-# Setup systemd
-sudo cp ~/LibreTranslate-init/libretranslate.service /etc/systemd/system/
-sudo systemctl start libretranslate
-sudo systemctl enable libretranslate
-
-# Configure Nginx
-sudo cp ~/LibreTranslate-init/nginx /etc/nginx/sites-available/default
-sudo nginx -t
-sudo systemctl restart nginx
+# Install and run LibreTranslate on port 5000
+pip install -e ~/LibreTranslate/
+libretranslate