Advertisement
E-werd

Throat Install Guide, base Alpine Linux 3.10 MariaDB

Jun 27th, 2019
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Title: Throat Install Guide, base Alpine Linux 3.10 MariaDB
  2.  
  3. ###
  4. ### Assume basic installation of Alpine Linux, openssh server installed and setup, a non-root user created and added to /etc/sudoers, bash installed
  5. ###
  6.  
  7. ## Switch to root and install dependencies
  8. sudo su -
  9. apk add --no-cache git bash build-base libffi-dev openssl-dev bzip2-dev zlib-dev readline-dev sqlite-dev curl bash bash-doc bash-completion redis npm jpeg-dev exiv2-dev boost-dev libxml2-dev libxslt-dev freetype-dev
  10.  
  11. ## This is needed for the pip stage later on
  12. ln -s /usr/lib/libboost_python37.so /usr/lib/libboost_python3.so
  13.  
  14. ## Create user under which throat is installed and switch to it.
  15. adduser --disabled-password --gecos "" -s /bin/bash app
  16. su - app
  17.  
  18. ## Setup pyenv
  19. curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
  20. echo 'export PATH="/home/app/.pyenv/bin:$PATH"' >> ~/.profile
  21. echo 'eval "$(pyenv init -)"' >> ~/.profile
  22. echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile
  23. exit
  24.  
  25. ## Database setup
  26. apk add --no-cache mariadb mariadb-client mariadb-connector-c-dev
  27. mysql_install_db --user=mysql --datadir=/var/lib/mysql
  28. rc-service mariadb start
  29. mysqladmin -u root password "Pass1234"
  30. rc-update add mariadb default
  31. mysql -u root -p
  32. CREATE DATABASE throat;
  33. CREATE USER 'throat'@localhost IDENTIFIED BY 'Pass1234';
  34. GRANT ALL PRIVILEGES ON throat.* TO 'throat'@localhost;
  35. exit
  36.  
  37. ## Start redis and add to startup
  38. rc-service redis start
  39. rc-update add redis default
  40.  
  41. ## Switch back to app and install python and set virtualenv
  42. su - app
  43. pyenv install 3.6.8
  44. pyenv virtualenv 3.6.8 app
  45.  
  46. ## Download throat, build css, assign dir to aforementioned virtualenv
  47. git clone https://phab.phuks.co/source/throat.git
  48. cd throat
  49. npm install
  50. npm run build
  51. pyenv local app
  52.  
  53. ## Upgrade pip, get requirements
  54. pip install --upgrade pip
  55. pip install -r requirements.txt
  56.  
  57. ## Create and modify config
  58. cp example.config.py config.py
  59. nano config.py
  60.  
  61. ##
  62. ## Database connection configuration
  63. ##
  64.  
  65. DATABASE = {
  66. 'host': 'localhost',
  67. 'name': 'throat',
  68. 'engine': 'MySQLDatabase',
  69. 'user': 'throat',
  70. 'password': 'Pass1234',
  71. }
  72.  
  73. ## Setup database
  74. scripts/migrate.py
  75.  
  76. ## to be able to access it from outside localhost...
  77. nano wsgi.py
  78. #add ", host='0.0.0.0'" to "socketio.run(app, debug=True)" inside parentheses
  79.  
  80. ## to run: ./wsgi.py
  81. ## find IP of your machine (ifconfig), visit: http://<ip address>:5000
  82.  
  83. ## Create an account for admin, close wsgi, then run:
  84. scripts/admins.py --add admin
  85.  
  86. ## To add created subs to defaults:
  87. scripts/defaults.py -a subname
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement