From 32ea9c6b15518ca313e45b91b66b16261757ec7a Mon Sep 17 00:00:00 2001 From: "P.J. Finlay" Date: Sat, 17 Jul 2021 16:06:46 +0000 Subject: Improvements --- README.md | 7 ++++++- nginx | 2 +- run.sh | 11 +++++++++++ setup.sh | 17 ++++------------- 4 files changed, 22 insertions(+), 15 deletions(-) create mode 100755 run.sh 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 -- cgit v1.2.3