progress on docs, fixes in basic setup

This commit is contained in:
2023-09-18 15:14:09 +02:00
parent 9a4d38be31
commit 130831f050
15 changed files with 143 additions and 108 deletions

View File

@@ -20,56 +20,40 @@
<h1>Installation</h1>
<p>Let's begin with setting up libreevent! If you are not technically savvy or want somebody else to set it up for you, please contact me <a href="https://api.janishutz.com/contact/setup?origin=libreevent&amp;campaign=installation-docs">here</a>. If you want to set it up yourself, read on below! Soon, there will also be a video tutorial available.</p>
<h1>Selecting a webhosting company</h1>
<p>Choosing the right hosting provider is not easy, especially since libreevent requires node.js. Therefore, we've listed a few really good options. Whatever hosting provider you end up going with, it is important that they explicitly list Node.js as a feature of that hosting account. All hosting providers below also include MySQL which is beneficial to have and a must-have when you are expecting to sell a lot of tickets simultaneously. This website here is hosted by asurahosting. <em>Note: I may receive a small commission when you buy webhosting using one of the links provided below. This won't affect the price you pay.</em>
https://clients.asurahosting.com/aff.php?aff=1997
https://www.novatrend.ch/en/
https://www.hostinger.com/
https://www.a2hosting.com/
https://www.hetzner.com/
https://www.digitalocean.com/</p>
<p><em>Affiliate program</em>
<p>Choosing the right hosting provider is not easy, especially since libreevent requires node.js. Therefore, we've listed a few really good options. Whatever hosting provider you end up going with, it is important that they explicitly list Node.js as a feature of that hosting account. All hosting providers below also include MySQL which is beneficial to have and a must-have when you are expecting to sell a lot of tickets simultaneously. This website here is hosted by asurahosting. <em>Note: I may receive a small commission when you buy webhosting using one of the links provided below. This won't affect the price you pay.</em></p>
<ul>
<li><a href="https://clients.asurahosting.com/aff.php?aff=1997">asurahosting</a></li>
<li><a href="https://www.novatrend.ch/en/">novatrend</a></li>
<li><a href="https://www.hetzner.com/">hetzner</a> (though make sure that you have a sufficiently high-end account!)</li>
</ul>
<p><em>Affiliate programs: TODO: Sign up</em>
https://affiliates.hostinger.com/users/signup/
https://www.a2hosting.com/about/affiliate-program/
https://www.digitalocean.com/go/affiliates</p>
<h1>Downloading libreevent</h1>
<p>We are going to start off by downloading libreevent. On this website, open the navigation menu and head to &quot;Downloads&quot;. (We would strongly suggest that you open the link in a new tab by right clicking on the link and hitting &quot;Open in new tab&quot;). Below, hit the download button. This will download a production ready build of libreevent as a zip file. Save it to any convenient location. Head there and extract the zip-Archive (On windows, right click, extract; On MacOS, just double click; on Linux, there is either a zip utility installed or otherwise use the unzip utility in the terminal).</p>
<h2>Database</h2>
<p>TODO: Make it so that it's not necessary to mention this here.
In the database, all the userdata is stored. libreevent currently supports two different databases, MySQL and a custom database based on JSON. Which one to choose?</p>
<p>Generally MySQL, except:</p>
<ul>
<li>If your organisation is small and does only sell a few tickets at a time, the JSON based database works perfectly fine.</li>
<li>Your web hosting plan does not includes MySQL and you've got no access to MySQL in any other way. <em>NOTE: Free MySQL services should NEVER be used in such an application, as most hosting plans include MySQL (or MariaDB, which works similarly) which is much more reliable and if you lose access to the database, you can only access the root account and all other user data (and therefore all user accounts) is lost. The event data is always stored in JSON format as it is more efficient this way.</em></li>
</ul>
<p><strong>NOTE: The JSON database is really slow and should only be used if you have a small event where you expect to sell less than 5 ticket per minute! The amount of tickets sold per minute that the system can handle really depends on the speed of the server the website runs on.</strong></p>
<p>MySQL generally is more time consuming to set up, but we'll run you through the process here to make the process easier for you.</p>
<p>If you are using the JSON-DB, continue reading:</p>
<p>Head into the folder you have downloaded libreevent into and open the &quot;config&quot; directory. In there you can see a few &quot;.json&quot; files. Open the &quot;settings.config.json&quot; file using a text editor (on Windows you could use Notepad, on MacOS TextEdit and on Linux, I personally like to use Nano or Vim, which are cli only or for graphical ones, use for example gedit).</p>
<p>In JSON, data is stored in so-called Key-Value-Pairs. Look for &quot;db&quot; in there and and replace the default &quot;mysql&quot; with &quot;json&quot;. Keep this file and folder open and skip the next chapter.</p>
<h2>Setting up a MySQL database</h2>
<p>At this point, we assume that you have already purchased webhosting and you are logged in to the administration panel of your webhosting provider. This guide will use the Web Control Panel called &quot;Direct Admin&quot;, as it is fairly common, along with cPanel. Somewhere, there should be a button that says something like &quot;MySQL Management&quot;. Click it, which will bring you to the MySQL-Database management page. Now, create a new database by clicking the &quot;Create new database&quot; (or similar) button which will bring up the database creation tool. Give the database any name you like and give the user any name you like. When creating a password, it is important that this password is long and complicated. What we recommend doing is using a password generator or to essentially &quot;sit&quot; onto your keyboard to get a random string of characters as the password.</p>
<p>TODO: Make setup better (including db setup), add notes on setup key
Now copy this password and open the download location of libreevent. Inside of the libreevent folder and open the &quot;config&quot; folder and open the file called &quot;db.config.json&quot; using a text editor (on Windows you could use Notepad, on MacOS TextEdit and on Linux, I personally like to use Nano or Vim, which are cli only or for graphical ones, use for example gedit). Now, paste the password between the empty quotes after &quot;password&quot;. For the host value type your domain, for the &quot;database&quot; parameter, type the name of the database you just created (including any prefixes shown there) and for the database user, type the username you just created (again, including any prefixes shown in the admin panel).</p>
<p>Now hit &quot;Create Database&quot; to actually create the database.</p>
<p>And just like that, you have finished setting up your database.</p>
<h1>Defining a setup key</h1>
<p>libreevent uses what we call a setup key. You need to set this manually, as it needs to be different for every install because otherwise the whole point of this setup key is to prevent unauthorized access to the setup program. The setup will be disabled once you have first completed it.</p>
<p>To set the setup key, navigate to the extracted libreevent folder and open it. In there you should find a file called &quot;setupkey.txt&quot;. Open it up and add any random assortment of characters and numbers in there. What we recommend is that you just roll your hand over your keyboard in any way you like as this generates a very much unpredictable assortment of characters. Then, hit Ctrl + S (or Command + S on MacOS) to save the file. We would recommend leaving this file open, as you will need the setup key at a later point.</p>
<h1>Uploading libreevent</h1>
<p>It is now time to upload libreevent to your webhosting account. The recommended way of doing this is to download a FTP client like &quot;FileZilla&quot; and to connect to the hosting account in that way using the credentials provided by the hosting provider. In this guide we assume you use this way.</p>
<p>Download and install FileZilla. It is a free and open source FTP client. Open it and you will see a few empty fields towards the top of the app. There you will need to fill in the information given by your hosting provider. Usually, the Host is ftp.yourDomain.com, the username and password are usually your admin account credentials and the port is usually 25552 or can be left empty. Then hit quick connect. At this point, a SSL warning might appear, as the certificate might not (yet) be configured correctly to also include FTP. Accept the certificate and you should be connected.</p>
<p>It is now time to upload libreevent to your webhosting account. The recommended way of doing this is to download an FTP client like &quot;FileZilla&quot; and to connect to the hosting account in that way using the credentials provided by the hosting provider. In this guide we assume you use this way.</p>
<p>Download and install FileZilla <a href="https://filezilla-project.org/download.php?platform=win64">for Windows (64-bit)</a>, <a href="https://filezilla-project.org/download.php?platform=osx">for MacOS</a> or for Linux (available in all major distro repos). It is a free and open source FTP client. Open it and you will see a few empty fields towards the top of the app. There you will need to fill in the information given by your hosting provider. Usually, the Host is ftp.yourDomain.com, the username and password are usually your admin account credentials and the port is usually 25552 or can be left empty. Then hit quick connect. At this point, a SSL warning might appear, as the certificate might not (yet) be configured correctly to also include FTP. Accept the certificate and you should be connected.</p>
<p>Now create a new folder called &quot;libreevent&quot; by right clicking onto the empty space on the right pane (where it says &quot;remote site&quot;) and selecting &quot;create directory&quot;. Then on the left side (where it says &quot;local side&quot; navigate to the extracted libreevent folder and upload its contents by selecting it and right clicking to hitting &quot;Upload&quot;). Once that process is completed, you should be set to go to the next session.</p>
<p><strong>IMPORTANT:</strong> Never upload libreevent into any public_html folders ever! This poses a SEVERE security risk and, if a JSON database is used, exposes ALL userdata to the internet! Always upload to a non-publicly accessible folder!</p>
<h2>npm install</h2>
<p>This project relies on a variety of different node.js modules that need to be installed on the server. Most webhosting providers give you an easy way to run <em>npm install</em>. If not, you might be required to upload the <em>node_modules</em> folder yourself. You can create such a folder either by downloading the <em>node_modules.zip</em> folder from the GitHub releases page or by installing npm on your local machine and then by running <em>npm i</em> in the terminal.</p>
<p>This project relies on a variety of different node.js modules that need to be installed on the server. Most webhosting providers give you an easy way to run <em>npm install</em>. If not, you might be required to upload the <em>node_modules</em> folder yourself. You can create such a folder either by downloading the <em>node_modules.zip</em> folder from the Download page or by installing npm on your local machine and then by running <em>npm i</em> in the terminal.</p>
<p>To set up the node application in most hosting providers, head to the admin panel of your hosting account once again. Navigate to the main page and scroll down until you find something that says &quot;Setup Node.js App&quot;. Click it and wait for it to load. Click &quot;Create Application&quot; and select the newest available Node.js version and set the Application mode to &quot;Production&quot;. For the application root insert the directory name which you have created just before when uploading.</p>
<p>For the Application URL field, click onto &quot;Choose any value&quot; and select an appropriate domain.</p>
<p>For the Application startup file type &quot;app.js&quot;.</p>
<p>In the section &quot;Environment variables&quot; hit &quot;Add Variable&quot; and in the appearing fields type beneath &quot;Name&quot; the following: &quot;PORT&quot; (without the quotes!) and under &quot;Value&quot; &quot;8080&quot; (again without quotes). Then hit done and at the top &quot;create&quot;. If you end up on the start page again, hit the little pencil icon to get to the application editor. Scroll down to the &quot;Detected configuration files&quot; section and click &quot;Run NPM Install&quot;. Once it shows a success message (at the top!), hit &quot;Restart&quot;.</p>
<p>CONGRATULATIONS! You are all set with the installation of libreevent! Now open a new tab in your webbrowser and type your domain name. If you can connect to your domain and libreevent is accessible, you are all set!</p>
<p>You may now continue reading the <a href="/docs/setup/setup">Setup guide</a></p>
<h1>Troubleshooting</h1>
<p>Here are some tips for the most common problems that might arise from the installation</p>
<h2>Not accessible, but running</h2>
<p>Some with some webhosting companies you need to remove the index.html file from the public_html directory of the domain you are running libreevent on.</p>
<h2>A placeholder is shown</h2>
<p>With some webhosting companies you need to remove the index.html file from the public_html directory of the domain you are running libreevent on.</p>
<h2>Can access all libreevent backend files</h2>
<p>You have most likely uploaded libreevent into the public_html file which you should NEVER do, as it poses an insane security risk. Delete it from that folder and put it into a different folder which is not publicly accessible.</p>
<p>You have most likely uploaded libreevent into the public_html file which you should NEVER EVER do, as it poses an insane security risk. Delete it from that folder and put it into a different folder which is not publicly accessible.</p>
<h2>libreevent doesn't start</h2>
<p>On most webhosting accounts, there's a file created in the directory of libreevent called something like stderr.log. Have a look at that file and compare errors with the ones listed here:</p>
<h3>DB HAS TO USE InnoDB!</h3>