Bookie is a simple Django app that stores links to information you intend to consume later. For example, if you found yourself bookmarking information from social media and websites, but your bookmarks are stored all over the place and you also forget to check what you have saved, then Bookie is for you!
Right now, you can only save links through Telegram.
I save a lot of links, tweets and articles that I intend to read later, but I always forget to actually check my what I have saved. On twitter I use the like or bookmark functionality to save interesting tweets for later. Sometimes I save them to my Saved messages on Telegram or use the Google Inbox bookmark functionality. Needless to say, I need a single source which stores all my links and notifies me after some period of time to remind me what I recently saved. And so Bookie was born.
My vision for Bookie includes:
- Mobile app
- Browser extension to save links directly from the browser
- More integrated services
- To be the number one source for all your saved links
If you want to add features to Bookie, you have a few options to run it locally:
- Docker
- Docker in Vagrant
- Vagrant
- Native
I personally use option 2 because I am using Windows and I have Virtualbox installed which doesn't play nice with docker :/
When running locally, the telegram integration wont work out of the box, you will need to register your own bot and use something like https://ngrok.com/. But this isn't necessary unless you are specifically developing features using telegram. Therefore Bookie will just set the telegram token to 123
unless otherwise specified.
Use the guideline below to start developing locally with vagrant and docker. If you don't want to use vagrant, simply skip the vagrant part and run docker-compose
.
$ vagrant up
$ vagrant ssh
vagrant@ubuntu-xenial:~$ cd /vagrant_data
vagrant@ubuntu-xenial:/vagrant_data$ sudo docker-compose -f dev.yml up -d
Now your local Bookie instance should be available on http://localhost:8000
on your host machine.
Tests should be run using Django, like below:
python manage.py test --settings=bookie.env.test
Right now, Bookie uses telegram to send data to Bookie. Therefore you need your own Telegram bot which you can read more about here https://core.telegram.org/bots#3-how-do-i-create-a-bot.
Once you have acquired your bot for bookie, you need to set a webhook to your Bookie intsallation. Your installation needs to be accessible from the Internet.
http POST https://api.telegram.org/bot<API_KEY>/setWebhook url=<YOUR_HOST>/api/telegram/API_KEY/
Bookie is designed to use docker for running in production while the vagrant and default setup is for local development.
- Clone the repo
pip install pipenv --user
pipenv shell
pipenv install
- Set your telegram api key
# Windows
set TELEGRAM_API_KEY=<api_key>
# Unix
export TELEGRAM_API_KEY=<api_key>
python manage.py runserver --settings=bookie.env.dev
(Run bookie in development mode)
- vagrant up && vagrant ssh
- Set your telegram api key
export TELEGRAM_API_KEY=<api_key>
- cd /vagrant_data
- Run Boookie
python3.7 manage.py runserver --settings=bookie.env.dev 0.0.0.0:8000
- Visit http://127.0.0.1:8000 on your host machine
- Create
/root/bookie.env
with the following contents:
TELEGRAM_API_KEY=
DJANGO_SECRET_KEY=
ALLOWED_DOMAINS=yourdomain.com,www.yourdomain.com
SENTRY_KEY=
sudo docker-compose -f prod.yml up -d
This will start a docker container listening on the host at 127.0.0.1:8000
. You will need to configure nginx or apache as a reverse proxy to serve static content, below you will find an nginx configuration example.
upstream bookie.local {
server 127.0.0.1:8000;
}
server {
listen 443 ssl;
server_name yourdomain.com;
root /var/www/yourdomain.com;
access_log /var/log/nginx/yourdomain.com.access.log main;
error_log /var/log/nginx/yourdomain.com.error.log error;
location / {
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://bookie.local;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
add_header Front-End-Https on;
add_header Strict-Transport-Security max-age=63072000;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
}
location /static {
alias /var/www/yourdomain.com/media;
}
ssl on;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
ssl_dhparam /etc/letsencrypt/live/yourdomain.com/dhparam.pem;
# enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL';
ssl_session_cache shared:SSL:10m;
#ssl_stapling on;
#ssl_stapling_verify on;
resolver 8.8.4.4 8.8.8.8 valid=300s;
resolver_timeout 10s;
ssl_prefer_server_ciphers on;
}
Any feedback or ideas are welcome! Want to improve something? Create a pull request!
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D