Git Product home page Git Product logo

keenable-community-forum's Introduction

Keenable Community-forum

cq_blog_perfect_collaboration_stack

  • 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..

First we would need to install Zulip server, and we have two options to install the server

  1. Normal installation
  2. Installation with Docker image

First will go for the normal installation and later if need we will also try the Docker image for installation.

1. Normal ibstallation : Localhosting(Steps)

  1. Download server
  2. Install script
  3. Create new organization
  4. Connect SMTP service
  5. Add Auth methods
  6. Databases Service Configuration (PostgreSQL)
  7. Video call integrations
  8. Mobile push notifications
  9. Maintenance
  10. Connect

Steps with details:

  1. 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.
  1. 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
  1. Create new organization Screenshot from 2023-12-29 18-31-37

  2. Connect SMTP service

  • 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

      image

      • 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.
  1. 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.

Screenshot from 2024-01-30 17-00-56

Screenshot from 2024-01-30 17-02-08

  • Later we have to update the Google Cloud console according to the given documentation.

Screenshot from 2024-02-01 13-12-35

  • Let's go on the Google Cloud Console

Screenshot from 2024-02-01 13-14-33

Screenshot from 2024-02-01 13-13-13

Screenshot from 2024-02-01 13-12-50

Screenshot from 2024-02-01 13-14-52

Screenshot from 2024-02-01 13-13-38

Screenshot from 2024-02-01 13-11-57

  • Finally we have enabled the service, now the sign up page would be look like this

google auth

  1. Databases Service Configuration (PostgreSQL)
  • Now we have to do a configuration of PostgreSQL and fo this we'll follow the "setting.py". Screenshot from 2024-02-08 00-08-36

  • 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'
  1. Video call integrations
  • Here we are using Jitsi service for enabling the call service feature.

image

  1. 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.
  1. Maintenance
  2. Connect

2. Installation with Docker image

Pre-requisite

  • Docker
  • Docker Compose

Steps:

  • 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

image

  • In the above screenshot, we can see that we have created 5 containers named redis postgres rabbitmq memcached and docker-zulip

Running management commands

# 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"

Screenshot from 2024-02-19 16-15-32

  • 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.

Deployment Architecture

Screenshot from 2023-12-29 00-16-05

Deployment Components:

  1. Nginx
  2. Tornado
  3. Django
  4. PostgreSQL

1. Nginx

image

  • 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.

    Features

    • 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.

PostgreSQL

image

  • 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.

History of PostgreSQL

  • It was started in 1986 by professor Stonebreaker as a follow up project. PostgreSQL is now the most advanced open-source database available anywhere.

Features of PostgreSQL

  • 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

  • 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.

Tornado

image

  • 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.

History of Tornado

  • 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.

Features of Tornado

  • 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.

Deployment

  • 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

image

  • 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.

History of Django

  • Born as a newspaper tool, Django blossomed into a globally beloved web framework, known for its speed, security, and ease of use.

Features of Django

  • 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.

Deployment

  • 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.

Testing

  • There are two types of web app testing.
    1. Manual Testing
    2. Automatic Testing.

keenable-community-forum's People

Contributors

akshaykumar05 avatar ankitv1001 avatar moinuddin0786 avatar

Watchers

 avatar

keenable-community-forum's Issues

Markdown to structure the command.

Use markdown to structure the command in readme.md file for all the used command.

Example:

  • EMAIL_HOST = "smtp-relay.sendinblue.com" EMAIL_HOST_USER = "[email protected]" EMAIL_PORT = 587
  • su zulip -c '/home/zulip/deployments/current/scripts/restart-server'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.