Setting up HTTPS on Nginx using Let’s Encrypt

There are many reasons for running a website on HTTPS instead of the regular HTTP. One reason is that Google Chrome soon will start to mark HTTP sites as insecure, possibly spooking your visitors. It is also a signal to your visitors that the communication between them and your website is protected.

In this article, I will describe how to set up Let’s Encrypt which provides free HTTPS certificates. It is part of a continuous effort to make the setup, described in the earlier articles, best-practice. I also offer some background information about HTTPS certificates for the interested reader.

Continue reading “Setting up HTTPS on Nginx using Let’s Encrypt”

Nginx and WordPress performance optimization 78% load time improvement

Apparently, performance on a website is essential. Slow sites are a pain for all visitors, and often slow sites put excessive load on the servers as well. To improve the performance of a website, a few tools will help us to pinpoint areas to enhance. It is a combination of settings in Nginx and WordPress. It builds on the setup described in this article but you can use the advice standalone. Most of the optimizations are useful on any web platform, not just WordPress, and Nginx.

Continue reading “Nginx and WordPress performance optimization 78% load time improvement”

Docker setup – part 8: Docker on multiple servers

This article builds on the platform described in the last seven parts, a WordPress setup running on AWS using Docker. In this article, we will look into how to improve uptime and scalability for the service by replicating it across multiple servers. To allow for replication, several challenges need to be solved. How to handle this is covered in this article, including comments on a few problems I found like Docker nodes running out of memory and how to fix it. And network problems in Docker swarm mode.

Continue reading “Docker setup – part 8: Docker on multiple servers”

Docker setup – part 7: Monitor uptime / status page

When running a blog or webshop, uptime monitoring becomes essential. We usually do not visit our own site 24/7, so we need some help to make sure we are notified if anything breaks. There exist many different tools for this. But one tool that I think solves this very cheap and easy is uptime robot, it is a hosted monitor service that monitors uptime for our site. How this work is explained in this article, and I will also touch on a few alternatives.

Continue reading “Docker setup – part 7: Monitor uptime / status page”

Programming puzzles – Spy game – NPComplete

When you have worked in a specific area for a long time, many of the tasks begin to be repetitive. One way to keep sharp is to engage the brain with programming puzzles. A site that contains many puzzles is hackerrank.com. The name is a bit over the top for my taste, but they keep an extensive list of many different programming challenges.

Each challenge is solved in the programming language you choose. It makes a great way to both keep the skills up to date and practice using programming languages that you do not use that often. Especially the challenges that are rated medium and up are good for keeping your skills sharp.

I have tried to tackle one of the most difficult challenges; spy game revisited if you keep on reading there will be spoilers so if you want to solve the problem your self, please stop reading. I will implement the solution using C# .NET. You can find the code here.

Continue reading “Programming puzzles – Spy game – NPComplete”

Docker setup – part 6: redundant php-fpm server

Redundant PHP-fpm service

Now the service stack has a load balancer, redundant Nginx web servers, but the PHP-fpm server is still only a single service. Most of the processing happens in the PHP-fpm server when serving a page request. The part prohibiting us from replicating the PHP-fpm service is that session data is stored in the local filesystem on the server. So if we just replicated the PHP-fpm server without replicating the sessions it would not work.

In this part, we will do the necessary changes to support a redundant PHP-fpm service.

Continue reading “Docker setup – part 6: redundant php-fpm server”

Integration testing in Python – RabbitMQ

When testing we mostly think about unit-testing. Even though the lines are a bit fuzzy most agree that a unit-test needs to run without any external dependencies and that it must run fast. In most cases, a unit is a single method or class that we test to see if it gives the expected output. If the unit has dependencies they should be exchanged for a test double/mock to make sure that we only test the logic inside the unit and not the workings of the dependencies.

But we can’t test everything using a unit-test. To expand our test coverage, one way to go is to use integration-tests. When using an integration we want to test how a unit interacts with other units or external dependencies.

Continue reading “Integration testing in Python – RabbitMQ”

Quant platform – part 1: Setting up

Finance has always fascinated me. It is ripe with mathematics, very hands-on, it has a global marketplace, the assets are valued all the time. Other interesting aspects are big data, complex relations and the possibility for endless challenges as the market evolves. It is a field perfect for trying out machine learning technology, and who knows maybe hit jackpot if the findings are profitable. But that is not an initial goal.

The goal for me is to set up a platform that allows me to build different trading algorithms and evaluate them.

Initially(this article), I want to

  • Find a python library to support building and backtesting algorithms
  • Setup an evaluation method to evaluate the performance of a strategy
  • Construct a simple trading algorithm to showcase the evaluation
  • Run the system on my own laptop on demand

Further down the line I want to

  • Have a system that can generate trading signals in different markets
  • Run the system on AWS and update automatically
  • Have a web frontend which shows the performance of the algorithm(s) and the signals
  • Have the algorithms connected to a real account to do automatic trading – far into the future

Of course, this is not an exhaustive list, and many more aspects of it will, without a doubt pop up. So keep reading.

Continue reading “Quant platform – part 1: Setting up”

Docker setup – part 5: cleanup

In this part the original thought was to setup the php-fpm server to be redundant and fix the problem with the db backup not running. It ended up being more of a cleanup of the setup. But I did learn many things about docker in the process.

We will cover the following things

  • How to remove a service from the docker swarm
  • Setting up a job scheduler in docker to run the backup jobs, for both files and database

Continue reading “Docker setup – part 5: cleanup”