- I'm building an open-source Community platform for Keenable organization, similar to the Discord and Slack but this web application would be open-source so that we can configure it according to our need.
- So first we would see the local hosting and configarions of the web applicationand and later we would see it's deployment.
- For the web application I have selected Zulip an open-source tool and now step by step we'll go for the localhost. Let's go..
- Normal installation
- Installation with Docker image
First will go for the normal installation and later if need we will also try the Docker image for installation.
- Download server
- Install script
- Create new organization
- Connect SMTP service
- Add Auth methods
- Databases Service Configuration (PostgreSQL)
- Video call integrations
- Mobile push notifications
- Maintenance
- Connect
- Download server
cd $(mktemp -d)
curl -fLO https://download.zulip.com/server/zulip-server-latest.tar.gz
tar -xf zulip-server-latest.tar.gz
- curl: Command-line tool for making HTTP requests.
- -f: Fail silently (i.e., don't show error messages).
- -L: Follow redirects (if the server responds with a redirect, curl will follow it).
- -O: Save the file with the same name as on the remote server.
- Install script
- Now we’ll install it. This command uses Certbot for automatic SSL and assumes that you are root user.
./zulip-server-*/scripts/setup/install --certbot \
--email=YOUR_EMAIL --hostname=YOUR_HOSTNAME
- So for zulip.gis.chat it becomes:
./zulip-server-*/scripts/setup/install --certbot \
--email=my_support_email@my_domain.de --hostname=zulip.gis.chat
-
Outgoing email (SMTP) credentials that Zulip can use to send outgoing emails to users (e.g. email address confirmation emails during the signup process, message notification emails, password reset, etc.).
-
However, people cannot register yet, so let’s connect the SMTP service to Zulip. All you need to do is add the credentials from your SMTP provider.
-
Enter them in /etc/zulip/settings.py and the password in /etc/zulip/zulip-secrets.conf.
EMAIL_HOST = "smtp-relay.sendinblue.com"
EMAIL_HOST_USER = "[email protected]"
EMAIL_PORT = 587
- Restart the server with command:
bash su zulip -c '/home/zulip/deployments/current/scripts/restart-server'
- I got an error here during restarting the server, that was "outhentication denied".
- Another error was "403 Forbidden" during opening the link of locally hosted server.
- Error during re-installing the server.
- SMTP Error
- We tried to enable this service, but user is not getting the mail request. (23 Jan 24)
- The most common error is not setting
ADD_TOKENS_TO_NOREPLY_ADDRESS=False
when using an email provider that doesn't support that feature.
connect: to ('Smtp.gmail.com', 587) None
reply: b'220 smtp.gmail.com ESMTP 12-20020a170902c24c00b001d770328a05sm3332281plg.36 - gsmtp\r\n'
reply: retcode (220); Msg: b'smtp.gmail.com ESMTP 12-20020a170902c24c00b001d770328a05sm3332281plg.36 - gsmtp'
connect: b'smtp.gmail.com ESMTP 12-20020a170902c24c00b001d770328a05sm3332281plg.36 - gsmtp'
send: 'ehlo vivek\r\n'
reply: b'250-smtp.gmail.com at your service, [2405:201:4019:618b:ecd1:7064:857d:deca]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [2405:201:4019:618b:ecd1:7064:857d:deca]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
send: 'STARTTLS\r\n'
reply: b'220 2.0.0 Ready to start TLS\r\n'
reply: retcode (220); Msg: b'2.0.0 Ready to start TLS'
send: 'ehlo vivek\r\n'
reply: b'250-smtp.gmail.com at your service, [2405:201:4019:618b:ecd1:7064:857d:deca]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [2405:201:4019:618b:ecd1:7064:857d:deca]\nSIZE 35882577\n8BITMIME\nAUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
send: 'mail FROM:<[email protected]> size=630\r\n'
reply: b'530-5.7.0 Authentication Required. For more information, go to\r\n'
reply: b'530 5.7.0 https://support.google.com/mail/?p=WantAuthError 12-20020a170902c24c00b001d770328a05sm3332281plg.36 - gsmtp\r\n'
reply: retcode (530); Msg: b'5.7.0 Authentication Required. For more information, go to\n5.7.0 https://support.google.com/mail/?p=WantAuthError 12-20020a170902c24c00b001d770328a05sm3332281plg.36 - gsmtp'
send: 'rset\r\n'
reply: b'250 2.1.5 Flushed 12-20020a170902c24c00b001d770328a05sm3332281plg.36 - gsmtp\r\n'
reply: retcode (250); Msg: b'2.1.5 Flushed 12-20020a170902c24c00b001d770328a05sm3332281plg.36 - gsmtp'
* After Resolving the error, I successfully sent the mail request from my side.
root@moinuddin-G3-3579:/etc/zulip# su zulip -c '/home/zulip/deployments/current/manage.py send_test_email [email protected]'
2024-01-25 04:55:45.828 ERR [zulip.send_email] An SMTP username was set (EMAIL_HOST_USER), but password is unset (EMAIL_HOST_PASSWORD). To disable SMTP authentication, set EMAIL_HOST_USER to an empty string.
If you run into any trouble, read:
https://zulip.readthedocs.io/en/latest/production/email.html#troubleshooting
The most common error is not setting ADD_TOKENS_TO_NOREPLY_ADDRESS=False when
using an email provider that doesn't support that feature.
Sending 2 test emails from:
* [email protected]
* noreply@localhost
Successfully sent 2 emails to [email protected]!
-
But I face an issue that User unable to get mail request.
-
We got the suggestion on Allemp to install Postfix locally (same server) on the zulip system. So now I'm exploring Postfix.
- Postfix is a hugely-popular Mail Transfer Agent (MTA) designed to determine routes and send emails. This cross-platform server is open-source, free, and suitable for installation on the majority of UNIX-like operating systems.
- Suggested link (from allemp) to Configure Postfix with Gmail on Ubuntu.
-
- Add Auth methods
-
Authentication Service facilitates username/password validation using your on-premises Active Directory/LDAP server. Authentication Service is installed as a virtual appliance and communicates with your local directory using LDAP over SSL.
-
I want to enable OAuth service with Zulip to login, that is: Google Authorization.
-
Oauth is one of the most secure methods of API authentication, and supports both authentication and authorization.
-
First of all we have uncommented the "Authentication_Backend" for Google OAuth service in "setting.py" and it can be seen below in atteched screenshots.
- Later we have to update the Google Cloud console according to the given documentation.
- Let's go on the Google Cloud Console
- Finally we have enabled the service, now the sign up page would be look like this
- Databases Service Configuration (PostgreSQL)
-
Now we have to do a configuration of PostgreSQL and fo this we'll follow the "setting.py".
-
First we'll uncomment Postgres Services as mentioned below:
REMOTE_POSTGRES_HOST = "dbserver.example.com"
REMOTE_POSTGRES_PORT = "5432"
REMOTE_POSTGRES_SSLMODE = "require"
- Now we have to restart the server with the command:
su zulip -c '/home/zulip/deployments/current/scripts/restart-server'
- Video call integrations
- Here we are using Jitsi service for enabling the call service feature.
- Mobile push notifications
- Push notifications are messages that can be sent directly to a user's mobile device. Unlike in-app messages, push notifications can appear on a lock screen or in the top section of a mobile device.
- Maintenance
- Connect
- Docker
- Docker Compose
- First we have to clone the repo of Zulip with following command:
git clone https://github.com/zulip/docker-zulip.git
cd docker-zulip
# Edit `docker-compose.yml` to configure; see docs below
- Then we'll edit the
docker-compose.yml
file - And we have to make 4 containers those are: Redis, Postgres, Rabbitmg and Memcached.
- Now we can boot our Zulip installation with following commands:
docker-compose pull
docker-compose up
- This will boot the 5 containers declared in
docker-compose.yml
- In the above screenshot, we can see that we have created 5 containers named
redis
postgres
rabbitmq
memcached
anddocker-zulip
# Get a (root) shell in the container so you can access logs
docker-compose exec zulip bash
# Create the initial Zulip organization
docker-compose exec -u zulip zulip \
/home/zulip/deployments/current/manage.py generate_realm_creation_link
- After this running mamanagement coomand, we'll get a "Local-host link"
- With the help of that link, we have to create an organization on Zulip web page, I created Keenable Computers Pvt Ltd as the Community organisation.
- Nginx
- Tornado
- Django
- PostgreSQL
- NGINX is open-source web server software used for reverse proxy, load balancing, and caching. It provides HTTPS server capabilities and is mainly designed for maximum performance and stability. It also functions as a proxy server for email communications protocols, such as IMAP, POP3, and SMTP.
- Can handle 10,000 concurrent requests.
- Catche HTTP requests
- Act as Reverse Proxy
- Act as a Load Balancer
- Act as an API Gateway
- Serve and Cache static files and images, videos, etc.
- Handle SSL Certificate.
- It is a powerful, open-source Object-Rational Database Management System (ORDMS).
- It is used to store data securily.
- It is developed by the PostgreSQL Global Development Group (a team of volunteers), it is not controlled by any corporation or other private entity.
- It was started in 1986 by professor Stonebreaker as a follow up project. PostgreSQL is now the most advanced open-source database available anywhere.
- It runs onall major OS like: Linux, Unix, and Windows.
- It supports text, image, sound, video and include interfaces for many language like: C, C++, Java etc.
- It supports a lot of features of SQL like: complex SQL queries, foreign key, triggers, views, transactions and concurrency etc.
- In PostgreSQL, table can be set to inherit their characteristics from a "parent" table.
- You can install several extentions to add additional funtionality to PostgreSQL.
- Deployment is the mechanism through which applications, modules, updates, and patches are delivered from developers to users.
- Deployment, also known as Software Deployment, is the process of installing, configuring, updating, and enabling one application or suite of applications that make a software system available for use, like facilitating a certain URL on a server.
- Handles multiple concurrent connections efficiently, ideal for long-polling, WebSockets, and real-time applications.
- Achieves high performance due to its single-threaded, non-blocking design
- Offers built-in support for WebRTC, enabling real-time audio and video communication.
- Tornado, the Python web framework, rose to prominence in 2009 due to its focus on handling high real-time traffic at FriendFeed. While initial releases gained traction, development slowed after 2012. Though lacking a large community like Django or Flask, it maintains a devoted following for its strength in scalability and real-time applications, becoming a testament to the potential of asynchronous programming in web development.
- Efficiently manages numerous concurrent connections, ideal for long-polling, WebSockets, and real-time interactions.
- Achieves high speeds due to its non-blocking, single-threaded design.
- Offers a clean, well-documented API, making it approachable for many developers.
- Built-in capabilities for real-time audio and video communication.
- Don't run as a single process to maximize performance. Launch multiple instances, often one per CPU core, with reuse_port=True for efficient load balancing.
- Consider using a front-end load balancer like Nginx to distribute traffic and handle static files, offloading Tornado from static content serving.
- Utilize process managers like supervisor or systemd to manage process start/stop, restarts, and monitoring.
- Use Python 3, avoid serving static files from Tornado, and employ a content delivery network (CDN) for static assets.
- Django is a high-level, free, and open-source Python web framework known for its rapid development, security, and scalability. It's built with the "DRY (Don't Repeat Yourself)" principle in mind, encouraging code reuse and efficient development.
- Born as a newspaper tool, Django blossomed into a globally beloved web framework, known for its speed, security, and ease of use.
- Django empowers rapid development with built-in features like user authentication, admin panel, ORM, and security, while boasting scalability and a large community, but might have a steeper learning curve compared to simpler frameworks.
- Adjust settings like database connections, static file paths, and secret keys for your environment.
- Use manage.py collectstatic to gather static assets like CSS and JavaScript.
- Use version control, automate deployments, and implement security measures like SSL/TLS.
- Cloud platforms like Heroku, AWS, or GCP offer ready-made solutions, or choose self-hosting on your own server.
- There are two types of web app testing.
- Manual Testing
- Automatic Testing.