├── LICENSE ├── README.md └── deploy.bash /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Classical Language Toolkit 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # escriptorium-deploy 2 | Script(s) to deploy the [eScriptorium](https://gitlab.inria.fr/scripta/escriptorium) application. 3 | 4 | ## Requirements 5 | 6 | Currently the script works on a fresh, stock Debian 10 system, whether running as the host OS, e.g. at a cloud provider, or under the excellent [Windows Subsystem for Linux v2 (WSL2)](https://docs.microsoft.com/en-us/windows/wsl/compare-versions#whats-new-in-wsl-2). 7 | 8 | ## Installation 9 | 10 | Ensure you have `sudo` access to the system. At the terminal, install `git`: 11 | 12 | ```shell 13 | $ sudo apt update 14 | $ sudo apt install git 15 | ``` 16 | 17 | Then grab the deployment script and run it. 18 | 19 | ```shell 20 | $ git clone https://github.com/cltk/escriptorium-deploy.git 21 | $ cd escriptorium-deploy 22 | $ bash deploy.bash 23 | ``` 24 | 25 | It will run for some time. At the end, you will be prompted to create a username and password for the administrative ("superuser") account on the system. 26 | 27 | ## Starting and stopping the application 28 | 29 | Depending on where you installed the system, change to the subdirectory containing the application. 30 | 31 | ```shell 32 | $ cd ~/escriptorium-deploy/escriptorium/app 33 | ``` 34 | 35 | Start the application: 36 | 37 | ```shell 38 | $ cd python manage.py runserver 0.0.0.0:8000 --settings=escriptorium.local_settings 39 | ``` 40 | 41 | It it stopped via CTRL-C in the same terminal. 42 | 43 | If running locally, the system should now be accessible at http://localhost:8000. 44 | 45 | 46 | -------------------------------------------------------------------------------- /deploy.bash: -------------------------------------------------------------------------------- 1 | PYTHON_VERSION=3.7.12 2 | 3 | sudo apt-get update 4 | sudo apt-get -y upgrade 5 | sudo apt-get -y install vim htop git curl tmux 6 | sudo apt-get -y install postgresql postgresql-contrib libpq-dev 7 | sudo apt-get -y install redis-server 8 | sudo apt-get -y install netcat-traditional jpegoptim pngcrush 9 | sudo apt-get -y install gfortran libopenblas-dev liblapack-dev 10 | sudo apt-get -y install libvips 11 | sudo apt-get -y install npm 12 | 13 | # python 14 | sudo apt-get -y install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev 15 | curl https://pyenv.run | bash 16 | 17 | cat <<'EOT' >> ~/.bashrc 18 | export PATH="~/.pyenv/bin:$PATH" 19 | eval "$(pyenv init -)" 20 | eval "$(pyenv virtualenv-init -)" 21 | export DJANGO_SETTINGS_MODULE=escriptorium.local_settings 22 | EOT 23 | 24 | # node 25 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash 26 | 27 | eval "$(awk '/pyenv/ {o=1}; o==1 {print}' ~/.bashrc)" 28 | 29 | pyenv install $PYTHON_VERSION 30 | 31 | # download the escriptorium code and install dependencies 32 | git clone https://gitlab.inria.fr/scripta/escriptorium.git 33 | cd escriptorium 34 | pyenv virtualenv $PYTHON_VERSION ocr 35 | pyenv local ocr 36 | pip install -U pip 37 | pip install numpy 38 | pip install -r app/requirements.txt 39 | 40 | # set up the database 41 | sudo service postgresql start 42 | sudo -u postgres createuser -s $USER 43 | createdb escriptorium 44 | 45 | # start redis 46 | sudo service redis-server start 47 | 48 | # set up the webapp 49 | pip install django-debug-toolbar django-extensions 50 | cp app/escriptorium/local_settings.py.example app/escriptorium/local_settings.py 51 | sed -i "s/provideyourusernamehere/$USER/; s/# 'USER'/'USER'/" app/escriptorium/local_settings.py 52 | echo "CELERY_TASK_ALWAYS_EAGER = True" | cat >> app/escriptorium/local_settings.py 53 | 54 | # the UI -- the horror of node.js 55 | nvm install node 56 | cd front 57 | npm install 58 | npm run production 59 | 60 | cd ../app 61 | python manage.py migrate 62 | python manage.py createsuperuser 63 | 64 | echo "All done. To run the server, issue:" 65 | echo "python manage.py runserver 0.0.0.0:8000 --settings=escriptorium.local_settings" 66 | 67 | exec $SHELL 68 | --------------------------------------------------------------------------------