What is OpenFire
Openfire is a real time collaboration (RTC) server licensed under the Open Source Apache License. It uses the only widely adopted open protocol for instant messaging, XMPP Openfire is incredibly easy to setup and administer, but offers rock-solid security and performance. -https://igniterealtime.org/projects/openfire/
Installing Docker
- Log into the Linux based device
- Run the following commands in the terminal
# install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER
Running OpenFire
- Now that Docker is installed, run the following commands to setup the OpenFire Docker container and run it
# create a working directory
mkdir /home/$USER/docker/openfire/db -p
# run the OpenFire docker container
docker run --name openfire -d -p 9090:9090 -p 5222:5222 -p 5269:5269 -p 5223:5223 -p 7443:7443 -p 7777:7777 -p 7070:7070 -p 5229:5229 -p 5275:5275 -v /home/$USER/docker/openfire/db:/var/lib/openfire/embedded-db --restart=unless-stopped quantumobject/docker-openfire - Open a web browser and navigate to http://DNSorIP:9090
- Select a language > Click Continue
- Set the XMPP Domain Name and Server Host Name (FQDN) to local > Click Continue
- Select Embedded Database > Click Continue
- Select Default on the Profile Settings page > Click Continue
- Input an admin email address and password > Click Continue
- Click the Login to the admin console button
- Login with username admin and the password created previously
- Click the Users/Groups tab
- Click Create New User in the left navigation menu
- Create a username and password for the new user
- Follow the steps to create as many users as needed, at least 2 are needed for testing
Making the Configuration Persistent
- With OpenFire now configured, run the following commands to copy the configuration files to a persistent volume and re-run the docker container
# create working directory for conf
mkdir /home/$USER/docker/openfire/conf -p
# copy the configuration from the running docker container
sudo docker cp openfire:/usr/share/openfire/conf/ /home/$USER/docker/openfire
# set owner of working directories
sudo chown "$USER":"$USER" /home/"$USER"/docker -R
# stop and remove the running OpenFire container
docker rm openfire --force
# re-run the OpenFire docker container with new conf volume
docker run --name openfire -d -p 9090:9090 -p 5222:5222 -p 5269:5269 -p 5223:5223 -p 7443:7443 -p 7777:7777 -p 7070:7070 -p 5229:5229 -p 5275:5275 -v /home/$USER/docker/openfire/db:/var/lib/openfire/embedded-db -v /home/$USER/docker/openfire/conf:/usr/share/openfire/conf --restart=unless-stopped quantumobject/docker-openfire
Setting Up A XMPP Client
- Download Pidgin Portable Download
- Run the Pidgin Portable installer
- Launch Pidgin Portable
- Click Add...
- Select XMPP from the protocol dropdown
- Input the first username created above along with the XMPP domain setup in OpenFire and the user's password
- Click the Advanced tab > Select Use encryption if available from the Connection security dropdown
- Enter the OpenFire DNS name or IP in the server field
- Click the Add button
- Click Accept on the self-signed certificate popup
- Copy the extracted Pidgin Portable folder to another device
- Launch Pidgin Portable on the second device
- Select Modify Account
- Update the username and password to be a different account from the previous device
- From one of the devices, select Buddies > Add Buddy
- Input the opposite devices's username
- On the second device accept the message request and the two devices should be able to send and receive instant messages using the OpenFire XMPP server
Documentation: https://github.com/QuantumObject/docker-openfire