doc updates

This commit is contained in:
janis
2023-09-18 10:11:58 +02:00
parent 9c8278df37
commit 5c6f189396
13 changed files with 165 additions and 59 deletions

View File

@@ -48,19 +48,44 @@ In the database, all the userdata is stored. libreevent currently supports two d
<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)
<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>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. 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. 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>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>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>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!</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>
<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>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>
<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>
<p>The MySQL database you are using is not supported by libreevent or is incorrectly configured. Please ensure that InnoDB is enabled. If you cannot enable it yourself, please contact the DB hosting provider.</p>
<h3>ERR_ENCODING_NOT_SUPPORTED</h3>
<p>If this error occurs, most likely, the Node.js build of your hosting provider is set to small-icu mode, meaning some localizations are missing, one of which is ascii, which is required by the pdf generator that libreevent uses. To resolve this, you will need to download a special package.json file and add two (more) environment variables:</p>
<ul>
<li>For the package.json file, download it from <a href="https://libreevent.janishutz.com/downloads/full-icu/package.json">here</a> TODO: Add download!</li>
<li>For the environment variables, add the following:</li>
</ul>
<pre><code>NODE_ICU_DATA=./node_modules/full-icu
FULL_ICU_PREFER_NPM=true
</code></pre>
<p><img src="/assets/environmentVariables.png" alt="EnvVars"></p>
<h3>Any other error</h3>
<p>Please click <a href="https://github.com/simplePCBuilding/libreevent/issues/new">here</a> to head to GitHub and open a new issue. You will need to have a GitHub Account to open an issue. If you don't have a GitHub account, you may also contact me using my <a href="https://api.janishutz.com/contact/report?origin=libreevent?error=unkown?lang=en">Bug reporting tool</a>.</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

View File

@@ -18,6 +18,11 @@
<div id="docPage">
<div id="doc-container">
<h1>Security best practices</h1>
<p>Whilst libreevent uses modern security features, no Software is perfect when it comes to security. This is why it is important to keep libreevent updated, as potential security issues are addressed with them, as well as potential bugs. Next to that, a incorrectly set up instance of libreevent might pose a security problem, but we try to make the attack surface as small as possible. The most significant security risk that can arise from improperly setting up libreevent is not using HTTPS for the server.</p>
<h2>Reverse Proxy</h2>
<p>For simplicity reasons, libreevent does not (yet) natively support SSL-Certificates. This is why libreevent should be put behind a reverse proxy to ensure that all users use SSL (Secure Sockets Layer) or TLS (Transport Layer Security) when connecting to it. Most webhosting plans are already behind a reverse proxy, you will just need to force a HTTPS redirect in the settings of the admin panel of the webhosting account. If you are manually deploying libreevent on a server without a reverse proxy, we urge you to use a reverse proxy with e.g. nginx or apache. There are a lot of guides out there on how to set a such up. Please also get yourself a Certificate for your domain and activate it. A common methods for acquiring such Certificates is to use the &quot;Certbot&quot; CLI application on Linux. It works with both apache and nginx and can automatically renew the certificate for you once it expires if set to run on a cronjob.</p>
<h2>HTTPS</h2>
<p>As mentioned previously in the Reverse Proxy section, you should always have HTTPS enabled using a reverse proxy. Since most hosting accounts already have a reverse proxy installed, you just need to set it to automatically redirect HTTP to HTTPS in the webhosting admin panel.</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>