Back to clever-cloud.com

Well, if you need some logos, we provide these:

svg ·  png
Red Clever Cloud logo
svg ·  png
svg ·  png
White Clever Cloud logo
svg · png
White Clever Cloud logo
svg · png
Posted at April 23, 2019 — Features

How to deploy The Lounge, an IRC client and logger

Yesterday I started talking with a partner on how we would collaborate. I just wanted an IM so I invited them on our Gitter and Slack. But they don't use any of these solutions. They use IRC. Which is great but then I did not have any logger or private server around. And being most of the time on the go, I have no stable connection. I need this logger. So I deployed one on Clever Cloud. This is how I did it.

How to deploy The Lounge

Googling my way through a nice solution called The Lounge. It's in their word:

“The self-hosted web IRC client.
Always connected.”

So it allows me to connect to a server, and can act as a logger too. And it works on mobile as a PWA. Always a nice plus. It's written in JavaScript and uses SQLLite for persistence. In Clever Cloud terms, it means I will need a Node.JS runtime to run the server and an FS-Bucket addon to store files. Here's how I have deployed everything.

git clone https://github.com/thelounge/thelounge.git
cd thelounge
clever create --type node thelounge
clever env set NODE_ENV production
clever addon create fs-bucket --plan s fsLounge
clever service link-addon fsLounge
clever env set THELOUNGE_HOME /app/home/
clever env set CC_FS_BUCKET /home:bucket-84d43724-d8ff-44a3-a4d9-053c45c3a5e4-fsbucket.services.clever-cloud.com
clever env set CC_PRE_RUN_HOOK 'yarn build && cp ./config.js /app/home/config.js'
clever env set NODE_BUILD_TOOL yarn

To configure it you can copy the default configuration in the home directory. First I have copied the default conf at the project root: cp defaults/config.js ./config.js

I then edited ./config.js to change the port to 8080. If you look at the CC_PRE_RUN_HOOK variable you can see the file will be copied in the home directory define in the environment variable THELOUNGE_HOME. Do not forget to commit your changes!

If you want to know exactly what you can configure you can take a look at their documentation.

Now we should be all good to go so one last command and The Lounge will be online: clever deploy

From now on you should see the deployment logs. Once it's over and you see success, type clever open and it will open the Lounge in your default web brower.

If you haven't change the default config you should be prompted with a Login screen. We do have to create a user. To do so they have a CLI tool. Or you can configure an LDAP server or another supported user directory. We will use the CLI tool. Fastest way to do this is to ssh to your instance by typing clever ssh.

From there you can cd into the directory of the application and type node index list to see the current users. As expected there are none. So go ahead and type node index add username. You will be prompted for a password. The user will be created and now you can login 🙂 Here is my terminal output for these operations:

bas@35e83ff3-f546-4c93-8c1d-c564d6f8673f ~ $ cd app_1ae60928-cb87-4c73-8e74-44ffd7b6e49a/
bas@35e83ff3-f546-4c93-8c1d-c564d6f8673f ~/app_1ae60928-cb87-4c73-8e74-44ffd7b6e49a $ node index list
2019-01-16 16:24:48 [INFO] There are currently no users. Create one with thelounge add <name>.
bas@35e83ff3-f546-4c93-8c1d-c564d6f8673f ~/app_1ae60928-cb87-4c73-8e74-44ffd7b6e49a $ node index add ldoguin
2019-01-16 16:24:52 [PROMPT] Enter password: 
2019-01-16 16:24:56 [PROMPT] Save logs to disk? (yes) 
2019-01-16 16:24:58 [INFO] User ldoguin created.
2019-01-16 16:24:58 [INFO] User file located at /app/home/users/ldoguin.json.

And that's it now you have your own IRC client, always online, that works on mobile and support push notifications. If you want to go further you can add your own domain name and you will have automatic SSL support thanks to our Let's encrypt automatic integration. You can also spend some time on TheLounge website and look at the different themes you can install or how to change the CSS. Happy Hacking!

Tags:

Laurent Doguin

Head of Developer Relation @clever_cloud. Devoxx Champion. I am also a nerdy metal head living in Paris.

Check out our Blog

We write about programming, security and Clever Cloud products

Join thousands of developers already using Clever Cloud. And try it for free!

Create your account now to start your apps and collaborate within a few minutes. For free with 20€ offered.

By signing up, your agree to our terms of use
Or
Sign in with Github