Notes on setting up Freedbin

Here are some notes on how to setup Rachel Sharp‘s Freedbin, which is a docker version of the popular Feedbin RSS feed reader.

I had some trouble setting this up on my Windows 10 machine. A lot of issues I faced had to do with setup and environmental variables. I don’t think I faced any real issues due to my host being Windows, other than the terrible thing that Windows 10 itself is. Anyways.

First of all, I had an already running version of postgres for other docker images, so there was a conflict I was not able to resolve, since Rachel’s docker compose file calls its images directly from Docker Hub which are not easily configurable. If someone can guide me to using the same postgres instance for two docker projects, that would be great! Right now, I have two docker containers running postgres.

So, (real) first of all, I downloaded the repo to my own machine to make modifications.

To begin, in the docker-compose.yml, I changed the name of the service from postgres to postgresfeedbin and changed the port to 5433 instead of the 5432 which was already in use.

I also changed the app image from rachsharp/feedbin to a local name freedbin_app and added the build line, so I could build the changes I’m putting in.

I added the restart unless-stopped line to ensure my containers never stop! 🙂

There’s a discussion on the github repo about replacing Postlight’s Mercury service with our own open source version of the same. Postlight has sunset their own servers, so it makes sense to use our own. One alternative is to use Feedbin’s own extract service, but that is available only in the newer version of Feedbin, which Rachel’s docker container doesn’t use. Instead, I already had a docker image of Mercury from the docker hub that I’ve setup for tt-rss and other projects, which I just connected to, using the MERCURY_HOST environment variable. In this setup, the MERCURY_API_KEY doesn’t do anything. Mercury just ignores it and it seems that so does Feedbin.

All of the above are summarized here, as part of the docker-compose.yml file –

app:
    # image: rachsharp/feedbin
    image: freedbin_app
    build: .
    restart: unless-stopped
    environment:
      - MERCURY_HOST=http://192.168.99.100:3000
      - MERCURY_API_KEY=abcd
      - SECRET_KEY_BASE=abcd
      - POSTGRES=postgresfeedbin
      - POSTGRES_USERNAME=feedbiner
      - POSTGRES_PASSWORD=feedbiner
      - PGPASSWORD=feedbin
      - DATABASE_URL=postgres://feedbiner:feedbiner@postgresfeedbin:5433/feedbin_production
[...]
  postgresfeedbin:
    image: postgres
    restart: unless-stopped
    command: -p 5433
    environment:
      - POSTGRES_USER=feedbiner
      - POSTGRES_PASSWORD=feedbiner
    ports:
      - 5433:5433
    expose:
      - 5433
    volumes:
      - postgres_data_feedbin:/var/lib/postgresql/data
volumes:
  redis_data:
  postgres_data_feedbin:

I further had to make changes to the startup_script.sh file as here –

if psql -h postgresfeedbin -p 5433 -U feedbin -lqt | cut -d \| -f 1 | grep -qw feedbin_production; then

As seen, I’ve just pointed it to the new service name and port.

At this point, the service was able to start. I was able to create an account and get in and add feeds. However, I follow a lot of feeds and importing an OPML file makes good sense for me. But, the import settings page was failing to import due to a failed AWS config. I looked up solutions and one way around is just to disable a connector called CarrierWave, which connects to AWS. Guess what gets disabled if you disable CarrierWave? The import/export page.

So, I went about creating an S3 bucket on AWS, getting credentials, and making the S3 bucket publicly accessible. I don’t know why this is the case. Perhaps if we use a newer version of Feedbin, these issues will not pop up, but in Rachel’s version, this is the case, so I went with it.

After I made my S3 bucket and got the AWS credentials, I added them to the Dockerfile as here. The variables are already there, just need to be filled up –

ENV FONT_STYLESHEET=https://fonts.googleapis.com/css?family=Crimson+Text|Domine|Fanwood+Text|Lora|Open+Sans RAILS_ENV=production RACK_ENV=production AWS_ACCESS_KEY_ID='my_key_id' AWS_S3_BUCKET='my_bucket_name' AWS_SECRET_ACCESS_KEY='sooooo_secret!' DEFAULT_URL_OPTIONS_HOST=http://localhost FEEDBIN_URL=http://localhost PUSH_URL=http://example.com RAILS_SERVE_STATIC_FILES=true

There’s one more catch. The Feedbin code uses its own version of CarrierWave called CarrierWave Direct, which defaults to try to use the ‘us-east-1’ region for AWS. If your bucket is there, you’re fine. Mine is in ‘us-west-1’, so I had to go into the /config/initializers/carrierwave.rb file and change the following to add my region –

config.fog_credentials = {
      provider: "AWS",
      aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"],
      aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
      region: 'us-west-1',
}

Finally, I am ready to build and deploy. Running the following command –

docker-compose build

You’ll notice a new image in your docker images list –

$ docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
freedbin_app                  latest              20a0334cd11c        30 minutes ago      1.27GB

and now you can deploy –

docker-compose up

It takes a while, as Rachel mentions somewhere, but all services come up perfectly, and I was able to import my OPML file. I noticed that the S3 bucket holds the lone OPML file, so perhaps it won’t cost me any money? Eventually, once I know that the import is done, I’ll go in and delete the bucket.

Big, big thanks to Rachel Sharp for creating Freedbin. It’s a great way to get started on Feedbin and while I was working on setting this up, I learnt how to use docker, created my first Docker container and uploaded my first project to Docker Hub. Hopefully, I’ll be able to build Freedbin from scratch using the latest Feedbin code and Feedbin’s extract service, and using the principles set down by Rachel.

Some Windows tools

I’ve been using Windows as my choice of office OS for a long time. I have a Mac at home, but for office work, Windows seems like the best choice. But not Windows itself. It is the apps that make it my go-to OS and often I find myself looking at OS X and thinking, “well I’m glad I have Windows too!”

Here’s a small list of Windows apps which I use on a daily basis –

  1. Sublime Text 2 – the less said about this, the better. This is the King of code.
  2. WinSCP – you know how you want to find a simple tool to send files to your servers and just can never get the workflow right? Or you want to quickly edit your linux VPS’ .bashrc and hate ssh-ing, then opening the file in vim/nano/emacs/pico/whatevs? This is it. Easy to use and manage. Right-click-Edit to open any editable file in the right editor (mostly Sublime Text for me). Or move files in and out of servers with ease. When I want to look at large log files and can’t be bothered with the CLI, I open them in Sublime Text through WinSCP.
  3. mRemoteNG – I have yet to discover all the awesome features this tool has. Manage your SSH/Telnet/RDP/VNC connections in the same app, organize everything into folders and export the connections as a file in Dropbox for ultimate portability. I recently discovered that if you punch in google.com and connect using HTTP/HTTPS, mRemoteNG fires off its in-built browser for your convenience. Woah!
  4. Rebex Tiny SFTP Server – recently, I got a Windows VM that I needed to send some files to. It was hooked up to the network, but not really setup. I looked for a solution and found rebex through this site. This thing works like a charm! I fired it off and started the default session (username: tester, password: password). The next moment, I had connected to it using WinSCP and was throwing files at it like a pro.
  5. CLink – I’ve only recently added this to my workflow. It makes the Windows command line so much better. The most important thing I needed in there is a persistent history, which Microsoft has till now ignored. CLink does the job and then some!

Notice that I’m talking about a very specific environment here. I’m in the networking-software testing world. But if you’re ever in a fix about what tool to use to edit code on Windows, or fling files between two networked but not truly connected machines, or are looking for a way to SSH into your servers across the world, these are the best tools out there.

I may add tools to this list as I go about discovering what else is out there. But that’s all for now.

A New Age of Windows Apps

Windows, for it’s spread across the world and it’s presence on every other computer you see, has for the past few years, suffered from a terrible lack of apps and widgets. While the rest of the world grew sudden mobile roots, Windows remained largely grounded on laptops and desktops. This meant that the apps that were making waves in the iOS and Android world were ported to OS X and Linux, but Windows was largely ignored.

With the coming of Google Chrome, making small widgets and apps became fairly easy. It was now not a matter of learning a complex platform dependent language like C# or a platform independent but newer languages like Ruby or Python. It was all about HTML, JavaScript and some CSS thrown together. Google Chrome handled the rest. Continue reading