Your own server

The app uses web sockets to communicate and because of that can not be hosted on services like Vercel or Netlify because they run on serverless functions and will turn off after 30 seconds.

You can deploy the apps on your own server using docker, each app has a Dockerfile in it's directory which you can use to make the docker image and run it on a VPS.

You can use any VPS config for the application but I recommend at least 4GB of RAM for it to run smoothly and handle multiple connections. You can get your server from DigitalOcean or Linode or any other provider.

This guide assumes it's an Ubuntu 22.04 instance.

Installing docker

You can follow this guide to setup docker on your server once you're done come back and we will continue.

Running the app

After installing docker clone the app or clone your own with changes you made into server.

git clone https://github.com/yasdpt/insta-quiz.git

cd insta-quiz

After that you will build images for each the server and the client.

Be sure to set the correct domains in .env files from domain names you choose in nginx setup section

cd server
cp .env.example .env

# build the image
docker build -t quizserver .

wait for the build to finish then from the root of the project again:

Two images with names quizserver and quizclient have been build, to run them run these commands:

After you containers are up and running you can now test them with their port on your server.

http://server_ip:8081 for server

http://server_ip:8082 for client

If firewall is up you have to give access for testing, remember to disable after

Setting up nginx

For your apps to be able to be used on Telegram they have to be https protocol.

You can use nginx and certbot to reverse proxy your apps and connect your domains to give Telegram.

After installing nginx enable it's profile on the firewall:

enable nginx

Then create files for subdomain configs

Make sure your subdomains are pointing at your server's ip in your domains dns settings

After that edit the files and insert configs for each:

Then paste this inside:

Click CTRL+X to and then Click Y to save.

Then do the same for the client:

And then paste:

Then reload nginx for the changes to take effect:

Certbot

For creating ssl certificates for your apps run command below:

Now you can check access to your client and server with their domain name.

After that you can set the bot's URL in @botfather as mentioned before in Testing guide.

Last updated