/link-shortener-2

Link shortener powered by Telegram bot using flat file database.

Primary LanguageRubyGNU General Public License v3.0GPL-3.0

Link shortener bot 2

Host your own link shortener that works with a bot. Just send the link to a bot and it'll take care of the rest for you. Demo: @AutoExpireShortLinkBot

This version has no external database dependency, and it you can spin it up with just one command.

Getting Started

  1. Install Docker and Docker Compose in your local machine or server
  2. Create a Telegram bot by talking to @BotFather
  3. Create and fill in the credentials to the env.yml file, see env.yml.example for the template
  4. run docker-compose up -d from the project root folder
  5. Send a link to your bot from Telegram, you should be see reply like (you will need to set up a backend too.)
YOU: http://example.com
BOT: Wow, try http://randomhost.name/abcdefgh

Prerequisites

  1. Following the Docker installation guide.
  2. Install Docker Compose
  3. Create a Telegram bot with @BotFather

Installing

After cloning the repo, you should create and fill in the credentials to the env.yml file, see env.yml.example for the template

To run locally using Docker:

$ docker-compose up

To run without Docker (requires locally installed Ruby 2.3.1+):

$ mkdir -p /run/links # sudo if this doesn't work
$ bundle install
$ bundle exec ruby bot/link-shortener-bot.rb &
$ bundle exec ruby web/app.rb &
$ bundle exec ruby autoremove/app.rb &

Deployment

On the deployment machine:

$ docker-compose up -d

Built With