Guest User

Untitled

a guest
Jul 8th, 2020
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.67 KB | None | 0 0
  1. #Assumes you're logged in as root
  2.  
  3. #install sudo and vim (vim is my personal preference of editor, you can use whatever you prefer)
  4. apt install -y sudo vim
  5.  
  6. #create the user to perform the install as - I named mine "stitcher"
  7. useradd -m stitcher
  8.  
  9. #create a password for the new user so you can login to it and for sudo commands
  10. passwd stitcher
  11.  
  12. #add stitcher to the sudo group
  13. usermod -aG sudo stitcher
  14.  
  15. #Switch to the stitcher user
  16. su - stitcher
  17.  
  18. #update app repositories
  19. sudo apt update
  20.  
  21. #install a bunch of prereqs
  22. sudo apt install php7.3 php7.3-xml php7.3-mysql php7.3-zip php7.3-redis composer nodejs gnupg2 lsb-release redis nginx php7.3-fpm mariadb-server git curl
  23.  
  24. #secure the mariadb installation - choose "y" for every question
  25. sudo mysql_secure_installation
  26.  
  27. #create a database for stitcher
  28. sudo mariadb
  29.  
  30. MariaDB [(none)]> create database stitcher;
  31. Query OK, 1 row affected (0.000 sec)
  32.  
  33. MariaDB [(none)]> grant all on stitcher.* to 'stitcher'@'localhost' identified by 'stitcher' with grant option;
  34. Query OK, 0 rows affected (0.000 sec)
  35.  
  36. MariaDB [(none)]> flush privileges;
  37. Query OK, 0 rows affected (0.000 sec)
  38.  
  39. MariaDB [(none)]> exit
  40.  
  41. #create a root web directory for stitcher
  42. sudo mkdir /var/www/stitcher
  43.  
  44. #enter the new directory above
  45. cd /var/www/stitcher
  46.  
  47. #clone the stitcher feed code
  48. git clone https://gitlab.com/adduc-projects/stitcher-rss-2.git
  49.  
  50. #enter the new cloned directory
  51. cd /var/www/stitcher/stitcher-rss-2
  52.  
  53. #copy the .env file from the template
  54. cp .env.example .env
  55.  
  56. #edit the .env file with the appropriate values. In my example, the only things you need to update are the DB name, the DB user and DB password
  57. vim .env
  58.  
  59. DB_DATABASE=stitcher
  60. DB_USERNAME=stitcher
  61. DB_PASSWORD=stitcher
  62.  
  63. #type this to save and quit vim: :wq
  64.  
  65. #we need to install yarn from an external repo
  66. #I followed this guide: https://linuxize.com/post/how-to-install-yarn-on-debian-10/
  67. curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
  68. echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
  69. sudo apt update
  70. sudo apt install yarn
  71.  
  72. #make sure we're in the root directory of the stitcher app
  73. cd /var/www/stitcher/stitcher-rss-2
  74.  
  75. #run compose stuff
  76. composer install
  77.  
  78. #run more compose stuff
  79. composer webpack
  80.  
  81. #initialize the database
  82. ./artisan migrate
  83.  
  84. #change permissions
  85. cd /var/www
  86. sudo chown -R www-data:www-data stitcher/
  87.  
  88. #give full access to storage directory
  89. sudo chmod -R 777 /var/www/stitcher/stitcher-rss-2/storage
  90.  
  91. #setup nginx
  92. #create a new config for this site
  93. vim /etc/nginx/sites-available/stitcher
  94.  
  95. #inside this file:
  96.  
  97. server {
  98.     listen 8080;
  99.     listen [::]:8080;
  100.  
  101.     root /var/www/stitcher/stitcher-rss-2/public;
  102.     index index.php index.html index.htm;
  103.  
  104.     location / {
  105.         try_files $uri $uri/ /index.php?$query_string;
  106.     }
  107.  
  108.     location ~ \.php$ {
  109.         include snippets/fastcgi-php.conf;
  110.         fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  111.     }
  112. }
  113.  
  114. #save and quit (:wq)
  115.  
  116. #link the available config to enabled
  117. sudo ln -s /etc/nginx/sites-available/stitcher /etc/nginx/sites-enabled/stitcher
  118.  
  119. #note, the above config will be accessible on port 8080 rather than the default port 80. You can change this to whatever port you'd like.
  120.  
  121. #restart nginx and cross your fingers that your site works:
  122. sudo systemctl restart nginx
  123.  
  124. #Now you should be able to see if it works by going to http://<<your ip>>:8080
  125.  
  126. #NOTE: I could not get this to work when using a local IP. I had to do some port forwarding on my router and visit the site by http://<<my external internet IP address>>:<<forwarded port>> to get the feeds working in Pocket Casts
Add Comment
Please, Sign In to add comment