Install on Ubuntu
note
While the following guide will show you how to install HuddleUp on a single server running Ubuntu, it is not required to do so exactly. There are different ways to install and serve HuddleUp. However, we will currently only document this approach.
This guide will show you how to install HuddleUp on a single server running Ubuntu. We will use PM2 for keeping our backend running and running the build process for the frontend.
#
Preparations- Make sure you have shell access to the server and your user has sudo rights
- You need two domains pointing to the IP of the server, these can also be subdomains
- One for the frontend (we'll use
huddle.huddle-up.org
) - One for the backend (we'll use
api.hudde.huddle-up.org
)
- One for the frontend (we'll use
#
Install requirementsFirst, make sure all package mirrors and installed packages are up to date.
Now, let's install the dependencies.
#
Configure PostgreSQLNext, we will create a PostgreSQL admin user and another user for HuddleUp. We will use admin
as the username for the administrator and huddleup
for the application user. You can of course choose different ones, if you want to.
First switch to the PostgreSQL system user.
Next, create the admin user. When prompted, choose the following answers:
- Name of role:
admin
- Password: Choose a strong password and save it somewhere safe!
- Superuser?
y
Repeat the process for the application user. When prompted, choose the following answers:
- Name of role:
huddleup
- Password: Choose a strong password (not the same as
admin
) and save it somewhere safe! - Superuser?
n
- Allow to create databases?
y
- Allow to create roles?
n
We will finalize the database setup in a further step.
We're done with Postgres for now, so we will switch back to your main user.
#
Create a system userNext we will create a system group and user for HuddleUp.
First, create the system user group:
Next, create the system user. The following command will create a user named huddleup
, with huddleup
as its primary group, add it to the www-data
group, create a home directory for it and set its default shell to bash.
If you want to be able to login as the system user, set its password with the following command. Again, use a unique, strong password and store it somewhere safe.
#
Setup the databaseNow, we'll finish the database setup. The next two commands will create a database called huddleup
and then enable the uuid
extension, which is required by HuddleUp.
#
Download the applicationNow it's time to download HuddleUp and prepare its environment.
First create a folder in /var
to install the application in it and set huddleup
as the owner of it.
Now, switch to the huddleup
user and clone the HuddleUp repository.
Next, we will install the package dependencies.
#
Configure HuddleUpNow it's time to configure HuddleUp. We'll just put some examples here, for more information on the configuration of HuddleUp, see here.
All configuration files are located in the config/
folder of the application. For this example, we'll use the public Jitsi Meet instance.
note
The domain and the OpenID Connect provider in this example do not exist. You will have to replace them with your own specific values.
#
ClientCreate a .env
file in the config/client
folder of the application. You can duplicate the .env.example
in that folder, or create new one.
#
BackendCreate a .env
file in the config/client
folder of the application. You can duplicate the .env.example
in that folder, or create new one. Treat the HU_AUTH_SECRET
like a password and make sure it is strong enough.
#
Building the ApplicationAfter having written the configuration, we can build the application.
note
This process can take a while for the first time.
#
Running migrationsBefore we can start the backend for the first time, we have to create the database schema.
#
Setup PM2To keep the backend running, and start it up automatically if you reboot the system we will be using PM2. We have already installed it in the first step, so we only have to set it up.
We will use the ecosystem file feature of PM2 to declare the task in a easy to manage file. To do this, create a file in the parent directory of the application.
Now we can start the backend for the first time!
You can check for the status of the process with pm2 status
and the huddle-up/logs
logs folder for errors.
To make sure that PM2 starts HuddleUp on a server reboot, we'll add it to the startup processes. Run the following command and copy the output.
Run the output as root and the automatic startup should be registered.
#
Setup NginxFirst, if you're still in the huddleup
user session, exit it.
For serving the client and forwarding requests to the backend, we will use Nginx. In a first step, we will setup the hosts for the two applications. Once these are set up, we'll setup HTTPS with Let's Encrypt.
#
Basic Configuration#
Client HostCreate a new Nginx configuration for the frontend at /etc/nginx/sites-available/000-stage.huddle-up.org.conf
with following content:
Enable it by linking it into the sites-enabled
folder and reloading nginx.
#
Backend HostWe'll do the same for the backend at `
Enable it by linking it into the sites-enabled
folder and reloading nginx.
#
Lets EncryptTo use HTTPS for connecting to the applications, we'll setup SSL certificates with Let's encrypt. We can let certbot
do the nginx configuration for us. When asked whether to always redirect, choose 'Yes'.
Finally, restart nginx for applying the changes.
And you're done! You should be able to use your HuddleUp installation now.