Advertisement
E-werd

Throat Install Guide, Hiawatha proxy, Alpine Linux 3.9.2

Mar 29th, 2019
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. ====
  2. Assume basic installation of Alpine Linux, openssh server installed and setup, a non-root user created.
  3. ====
  4.  
  5. su -
  6. 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 mariadb mariadb-client mariadb-connector-c-dev jpeg-dev exiv2-dev boost-dev libxml2-dev libxslt-dev
  7. adduser --disabled-password --gecos "" -s /bin/bash app
  8. su - app
  9.  
  10. curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
  11. echo 'export PATH="/home/app/.pyenv/bin:$PATH"' >> ~/.bashrc
  12. echo 'eval "$(pyenv init -)"' >> ~/.bashrc
  13. echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
  14. bash
  15. pyenv install 3.5.7
  16. pyenv virtualenv 3.5.7 app
  17.  
  18. git clone https://phab.phuks.co/source/throat.git
  19. cd throat
  20. npm install
  21. npm run build
  22. pyenv local app
  23. pip install --upgrade pip
  24. pip install -r requirements.txt
  25.  
  26. exit
  27. exit
  28. mysql_install_db --user=mysql --datadir=/var/lib/mysql
  29. rc-service mariadb start
  30. mysqladmin -u root password "P@ssword"
  31. rc-update add mariadb default
  32. mysql -u root -p
  33. CREATE DATABASE throat;
  34. CREATE USER 'throat'@localhost IDENTIFIED BY 'P@ssword';
  35. GRANT ALL PRIVILEGES ON throat.* TO 'throat'@localhost;
  36. exit
  37.  
  38. rc-service redis start
  39. rc-update add redis default
  40.  
  41. su - app
  42. bash
  43. cd throat
  44. cp example.config.py config.py
  45. nano config.py
  46. #set DB_USER to throat
  47. #set DB_PASSWD to P@ssword
  48. #set DB_NAME to throat (or whatever was created, default is phuks)
  49.  
  50. cd scripts
  51. ./install.py
  52. cd ..
  53.  
  54. # to run: ./wsgi.py
  55. # find IP of your machine, visit: http://<ip address>:5000
  56. # username: admin, password: adminadmin
  57.  
  58.  
  59. ====
  60. Hiawatha
  61. ====
  62.  
  63. su -
  64. apk add cmake make musl-dev util-linux php7-json php7-fpm
  65. wget https://www.hiawatha-webserver.org/files/hiawatha-10.9.tar.gz
  66. tar -xzf hiawatha-10.9.tar.gz
  67. cd hiawatha-10.9/
  68. mkdir build && cd build
  69. cmake .. -DENABLE_MONITOR=ON -DENABLE_TOMAHAWK=ON -DCMAKE_INSTALL_PREFIX=/usr -DCONFIG_DIR=/etc/hiawatha/ -DWORK_DIR=/var/tmp/hiawatha -DPID_DIR=/var/run -DLOG_DIR=/var/log/hiawatha -DWEBROOT_DIR=/var/www/hiawatha
  70. make install/strip -j 8
  71. addgroup www-data
  72. adduser -s /sbin/nologin www-data -D -H -G www-data
  73.  
  74. nano /etc/hiawatha/hiawatha.conf
  75. --Uncomment #ServerId = www-data
  76.  
  77. nano /etc/init.d/hiawatha
  78. ==========
  79. #!/sbin/openrc-run
  80.  
  81. # /etc/init.d/hiawatha: start and stop the Hiawatha webserver daemon
  82.  
  83. NAME="Hiawatha"
  84. DAEMON=/usr/sbin/hiawatha
  85. WIGWAM=/usr/sbin/wigwam
  86. PIDFILE=/var/run/hiawatha.pid
  87.  
  88. description="hiawatha-webserver.org on Alpine Linux"
  89. #extra_started=""
  90.  
  91. #depend() {
  92. # dependency information if any required
  93. #depend net
  94. #use logger dns
  95. #}
  96.  
  97. start() {
  98. rm -f $PIDFILE
  99. [ -x $DAEMON ] || exit 5
  100. umask 077
  101. echo -n $"Starting Hiawatha webserver: "
  102. $WIGWAM -q || failure
  103. start-stop-daemon --start --exec "$DAEMON" --pidfile "$PIDFILE"
  104. }
  105.  
  106. stop() {
  107. echo -n $"Shutting down Hiawatha webserver: "
  108. start-stop-daemon --stop --exec $DAEMON --pidfile $PIDFILE
  109.  
  110. }
  111.  
  112. hwstatus() {
  113. echo "$PIDFILE" -l $NAME $DAEMON
  114. }
  115.  
  116. restart() {
  117. stop
  118. start
  119. }
  120. ==========
  121.  
  122.  
  123. nano /etc/hiawatha/hiawatha.conf
  124. - Append to bottom of file, modify for your setup.
  125. ==========
  126. VirtualHost {
  127. Hostname = 192.168.1.198
  128. WebsiteRoot = /var/www/hiawatha
  129. AccessLogfile = /var/log/hiawatha/throat/access.log
  130. ErrorLogfile = /var/log/hiawatha/throat/error.log
  131. ReverseProxy / http://127.0.0.1:5000/
  132. }
  133. ==========
  134.  
  135. mkdir /var/log/hiawatha/throat
  136. chmod +x /etc/init.d/hiawatha
  137. rc-service hiawatha start
  138. rc-update add hiawatha default
  139.  
  140. # Now go back to throat folder and run
  141. su - app
  142. bash
  143. cd throat
  144. ./wsgi.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement