E-werd

Throat Install Guide, base Debian Linux 10.4 PostgreSQL

Jul 1st, 2020
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. Title: Throat Install Guide, base Debian Linux 10.4 PostgreSQL
  2.  
  3. ###
  4. ### Assume basic installation of Debian Linux, openssh server installed and setup, a non-root user created and added to /etc/sudoers
  5. ###
  6.  
  7. ## Switch to root and install dependencies
  8. sudo su -
  9. apt install -y git redis-server build-essential libmagic-dev libexiv2-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget libffi-dev curl libssl-dev npm libboost-python-dev libcairo2-dev libgirepository1.0-dev libgexiv2-dev libpq-dev
  10.  
  11. ## Create user under which throat is installed and switch to it.
  12. adduser --disabled-password --gecos "" app
  13. su - app
  14.  
  15. ## Setup pyenv
  16. curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
  17. echo 'export PATH="/home/app/.pyenv/bin:$PATH"' >> ~/.profile
  18. echo 'eval "$(pyenv init -)"' >> ~/.profile
  19. echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile
  20. exit
  21.  
  22. ## Database setup
  23. apt install postgresql postgresql-client
  24. sudo su - postgres
  25. psql
  26. CREATE DATABASE throat;
  27. CREATE USER throat PASSWORD 'Pass1234';
  28. GRANT ALL PRIVILEGES ON DATABASE throat TO throat;
  29. exit
  30. exit
  31.  
  32. ## Start redis and add to startup
  33. systemctl enable redis-server
  34. systemctl start redis-server
  35.  
  36. ## Switch back to app and install python and set virtualenv
  37. su - app
  38. pyenv install 3.7.8
  39. pyenv virtualenv 3.7.8 app
  40.  
  41. ## Download throat, build css, assign dir to aforementioned virtualenv
  42. git clone https://github.com/Phuks-co/throat.git
  43. cd throat
  44. npm install
  45. npm run build
  46. pyenv local app
  47.  
  48. ## Upgrade pip, get requirements
  49. pip install --upgrade pip
  50. pip install -r requirements.txt
  51.  
  52. ## Install psycopg2 for Peewee Postgres driver
  53. pip install psycopg2
  54.  
  55. ## Create and modify config
  56. cp example.config.yaml config.yaml
  57. nano config.yaml
  58.  
  59. ##
  60. ## Database connection configuration
  61. ##
  62.  
  63. ## Fill out the "database:" section:
  64.  
  65. engine: 'PostgresqlDatabase'
  66. host: 'localhost'
  67. port: 5432
  68. user: 'throat'
  69. password: 'Pass1234'
  70. name: 'throat'
  71. autocommit: True
  72.  
  73.  
  74. ## Setup database
  75. scripts/migrate.py
  76.  
  77. ## to be able to access it from outside localhost...
  78. nano throat.py
  79. #add ", host='0.0.0.0'" to "socketio.run(app, debug=True)" inside parentheses
  80.  
  81. ## to run: ./throat.py
  82. ## find IP of your machine (ifconfig), visit: http://<ip address>:5000
  83.  
  84. ## Create an account for admin, close wsgi, then run:
  85. scripts/admins.py --add admin
  86.  
  87. ## To add created subs to defaults:
  88. scripts/defaults.py -a subname
Add Comment
Please, Sign In to add comment