No description
Find a file
2023-03-12 19:10:36 +01:00
src post remote tests and fixes and logs removed 2023-03-12 19:10:36 +01:00
tests post remote tests and fixes and logs removed 2023-03-12 19:10:36 +01:00
.gitignore tests 2023-03-10 12:44:23 +01:00
.woodpecker.yml remote test & lots of fixes 2023-03-10 16:28:24 +01:00
genSelfSignedCert.sh tests 2023-03-10 12:44:23 +01:00
package-lock.json config change 2023-03-08 12:52:57 +01:00
package.json config change 2023-03-08 12:52:57 +01:00
readme.md server framework 2023-02-28 14:44:10 +01:00
test.juml changed db user 2023-03-10 12:58:38 +01:00
tsconfig.json server framework 2023-02-28 14:44:10 +01:00

Outbag Server

Mybe outdated!!!

Did you know that you can host your own outbag instance?

This repo contains the official outbag server.

Setup

*Keep in mind that you need a valid SSL certificate for your domain

Using docker

Find docker instructions in the docker repo

Manually

Requirements

  • git
  • nodejs & npm
  • a mysql database, we recommend mariadb

Setting up MariaDB

  1. Install mariadb using your system's package manager. e.g.:
    sudo apt install mariadb-server
    
  2. Secure your installation
    sudo mysql_secure_installation
    
  3. Start the MySQL/MariaDB command line mode (you have to enter the befor given paswsord):
    sudo mysql -u root -p
    
  4. Then a MariaDB [root]> prompt will appear. Create an user and a databse:
    CREATE USER 'outbagUser'@'localhost' IDENTIFIED BY 'aSecurePassword';
    CREATE DATABASE IF NOT EXISTS outbag CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
    GRANT ALL PRIVILEGES ON outbag.* TO 'outbagUser'@'localhost';
    FLUSH PRIVILEGES;
    
    To not forget to replace username, password and database name.
  5. You can quit the prompt by entering:
    quit;
    

Install

  1. Clone this git repo
    git clone https://gitlab.com/outbag/server/ outbag-server
    cd outbag-server
    
  2. Download & install the dependecies
    npm install
    

Setup - with config file

  1. Create a config file, e.g. in /opt/config.juml, or run the server once, to autogenerate that file.
    node . -c /opt/config.juml
    
  2. The server will crash. Now open the config file with your favourite text editor. You have to change the database login details.
  3. If you do not proxy your Server from https to http, you have to add the path to your ssl certificate and enable ssl.
  4. After closing the file, you can restart the server (It should not crash this time)
    node . -c /opt/config.juml
    

Setup - with environment variables

  1. List of environment variables with default values:
    OUTBAG_PORT=7223
    OUTBAG_EXPOSED_PORT=7223
    OUTBAG_EXPOSED_PATH=/
    OUTBAG_HOST=localhost
    OUTBAG_CERT_LIVE_SEC=2592000
    
    OUTBAG_SSL_ENABLED=false
    OUTBAG_SSL_PRIVATE_KEY=privkey.pem
    OUTBAG_SSL_CERT=cert.pem
    OUTBAG_SSL_CHAIN=chain.pem
    
    OUTBAG_MYSQL_HOST=localhost
    OUTBAG_MYSQL_PORT=3306
    OUTBAG_MYSQL_USER=admin
    OUTBAG_MYSQL_PASSWORD=12346789
    OUTBAG_MYSQL_DATABASE=outbag
    
    OUTBAG_MAX_USERS=0
    OUTBAG_DEFAULT_MAX_ROOMS=3
    OUTBAG_DEFAULT_MAX_ROOMS_SIZE=10000
    OUTBAG_DEFAULT_MAX_USERS_PER_ROOM=5
    
    Only set the environment variables you want to change. You have to set the MYSQL varibales.
  2. If you do not proxy your Server from https to http, you have to set the path to your ssl certificate and enable ssl.
  3. Start the server
    node .
    

Hosting the UI

As of writing, there is no official method of having the backend host the UI yet (we are working on it).

For the time being, just follow the manual guide

Setting up and using a proxy

NOTE: This is for advanced users only

If you do not want to expose multiple ports, you can use a proxy to expose both the app and the server on the same port.

  1. Download nginx (or your favourite nginx alternative, e.g. apache) using your system's package manager. e.g.:
    sudo apt install nginx
    
  2. Open the config file using your favourite text editor. NOTE: The nginx config file is probably located at /etc/nginx/http.d/default.conf You probably want something similar to this in your config file:
    location /api {
       if ($request_uri ~* "/api(/.*$)") {
          set  $path_remainder  $1;
       }
       proxy_pass http://127.0.0.1:7223/$path_remainder;
       proxy_set_header Host $http_host;
       proxy_buffering off;
    }
    location /.well-known/outbag/server {
       proxy_pass http://127.0.0.1:7223/.well-known/outbag/server;
       proxy_set_header Host $http_host;
       proxy_buffering off;
    }
    location / {
       proxy_pass http://127.0.0.1:8080$request_uri;
       proxy_set_header Host $http_host;
       proxy_buffering off;
    }
    
  3. Next up enable and start the system service (e.g. systemctl enable nginx and systemctl start nginx; or rc-update add nginx and rc-service nginx start)
  4. Now open 127.0.0.1 or <your.domain.com> (when using https) in your browser and you should be prompted with the webapp (in case you enabled it)
  5. To be able to use the server properly, you should go back to the docker-compose.yml file and change the OUTBAG_EXPOSED_PATH variable to point to /api.
  6. To finish of, restart the containers:
    docker-compose down
    docker-compose up -d
    

API

API docu