Blog Archive: May 2020

How To Swap / Transfer IP address with Linode VPS

| Servers | 73 seen

Recently I was rebuilding a compromised VPS on the Linode - this was a small web server serving some 3 established websites. It took me a few hours from A-Z  - launch a new Linode, install a new webserver on it, then transfer data from one host to another.

Once all migration works were done, there was an option to change DNS entry to point to the new server. Nothing complicated. But there is a neat feature from Linode called - Swap IP (IP Transfer). That's a little perk from Linode and quite good for SEO

You can get a cheap VPS starting just $5/mo from Linode. That's what I did - bought a new Linode just for $10

If you have two Linodes in the same data center, you can use the IP transfer feature to switch their IP addresses. This could be useful in several situations. For example, if you’ve built a new server to replace an old one, you could swap IP addresses instead of updating the DNS records.

IP Transfer with Linode

Here are the instructions how to transfer IP on Linode (found here: How do I move an IP Address around between different Linodes?)

  • Login to the Linode Cloud Manager. https://cloud.linode.com
  • Click on "Linodes" in the bar on the left.
  • Select the Linode which has the IP address set up with DNS records.
  • In the upper-right corner of the page, you will see a pull down menu that shows the state of your Linode. If it is running, select Power Off and make a note of its name.
  • Go back to the Linodes page.
  • Select the Linode which you would like to get the IP which is already set up for DNS.
  • Click on the "Networking" tab and scroll to the bottom.
  • Click on "IP Transfer".
  • Select the IP Address (if there is more than one address assigned to this Linode)
  • Under Actions, select "Swap With"
  • A pulldown will appear that will let you select the Linode that has the IP address you want.
  • Select the IP address from those addresses that Linode has.
  • Click "Save"
  • You can now boot your Linode and work with it.

  • How To Block IP Address in Drupal 8

    | Drupal Development | 118 seen

    Unlike in Drupal 7 version where IP banning is enabled by default, with Drupal 8 version, there is one more step added - IP banning must be enabled from the extend section.

    Here is how. (source)

  • Log into your Drupal 8 admin interface.
  • From the top menu bar, click on the menu tab and then the Extend tab from the second menu bar.
  • You are now on the modules list page. The Ban module is listed under the Core category. To enable it, simply click on the checkbox to the left of the module.
  • Once selected, scroll to the bottom and click on the Save Configuration button to enable the module. Now that you have the Ban module enabled, you can now block IP addresses.
  • Now head to the Configuration -> People -> IP address bans and manually enter IP addresses that are abusing your Drupal 8 website

    Ip address bans in Drupal 8


    Under The Georgian Sun / King Davids Tower (s)

    | | 17 seen

    It was on the evening of April 27, 2020, I decided to switch glass (from the kit lens to telephoto) and make some photo for the month of April to put in the description in the monthly dividend income report.

    The photo of the month turned out to be a sunset in Tbilisi with skyscraper in the foreground

    King David Towers in Tbilisi

    From the KDR website

    Two landmark towers King David Residences and King David Business Center are harmonically united in an exclusive multifunctional complex King David.

    King David creates a five-star lifestyle within exceptionally elegant residential and business towers with beautifully designed amenity spaces organized enticingly as a multistory urban resort and exclusive collection of specially-designed services.

    King David Residences - the tall tower, which contains luxury Residences, has been designed to create a lifestyle of true sophistication. Floor-to-ceiling window walls capture the breathtaking panorama of Tbilisi, allow for abundant natural light and create a sense of tranquility in each and every home.

    Each residence will provide inspiration, comfort, and empowerment for its residents. This unique full-service condominium residence introduces a new way of living in Tbilisi, merging comfort and convenience to balance the demands of today’s active lifestyles. Residents can spend their days working, relaxing, and socializing throughout their own building.

    This project offers opportunities for people to live and work in the downtown area, meeting the city's long-term objectives. King David Business Center is built with thoughtful amenities and luxurious conveniences to create the right working environment for business organizations.

    King David is a celebration of excellence and innovation, with an estimated completion date of July 2017, which will be an architecturally significant addition to the Tbilisi skyline.

    Taken April 27, 2020 / Sigma photo lens 70-300mm

     


    How To HTTPS Secure Drupal 8 Running Nginx with Let's Encrypt on Ubuntu 18.04

    | Servers | 47 seen

    Let's Encrypt have done some very good job, providing SSL certificates that everyone can use absolutely for free. Encrypted HTTPS websites should be default in 2020.

    I have been implementing HTTPS secure websites for years. Until now I mostly worked with Drupal 7 websites and for securing them I have been using this guide, back from 2016 - Linode: How To Secure Nginx with Let's Encrypt on Ubuntu 12.04

    Now, in 2020, working on a new, Drupal 8 powered, website after then initial web development was completed,  I was looking for an easy way to implement a free SSL certificate from Let's Encrypt.

    And here comes this tutorial from Digital Ocean in help: How To Secure Nginx with Let's Encrypt on Ubuntu 18.04

     in 2020, installing, obtaining and renewing an SSL certificate is much easier than it was back in 2016

    Before proceeding, make sure you have installed Drupal 8 with Nginix on Ubuntu 18.04,

    Non secure Drupal 8 website

    Step 1: Installing Certbot

    The first step to using Let’s Encrypt to obtain an SSL certificate is to install the Certbot software on your server.

    Certbot is in very active development, so the Certbot packages provided by Ubuntu tend to be outdated. However, the Certbot developers maintain a Ubuntu software repository with up-to-date versions, so we’ll use that repository instead.

    First, add the repository:

    sudo add-apt-repository ppa:certbot/certbot

    You’ll need to press ENTER to accept.

    Install Certbot’s Nginx package with apt:

    sudo apt install python-certbot-nginx

    Certbot is now ready to use, but in order for it to configure SSL for Nginx, we need to verify some of Nginx’s configuration.

    Step 2: Obtaining an SSL Certificate

    Certbot provides a variety of ways to obtain SSL certificates through plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading the config whenever necessary. To use this plugin, type the following:

    sudo certbot --nginx -d optionsbrew.com

    This runs certbot with the --nginx plugin, using -d to specify the names we’d like the certificate to be valid for.

    If this is your first time running certbot, you will be prompted to enter an email address and agree to the terms of service. After doing so, certbot will communicate with the Let’s Encrypt server, then run a challenge to verify that you control the domain you’re requesting a certificate for.

    If that’s successful, certbot will ask how you’d like to configure your HTTPS settings.

    Configuring certbot

    Select your choice then hit ENTER. The configuration will be updated, and Nginx will reload to pick up the new settings. certbot will wrap up with a message telling you the process was successful and where your certificates are stored:

    Your certificates are downloaded, installed, and loaded. Try reloading your website using https:// and notice your browser’s security indicator. It should indicate that the site is properly secured,

    Secure HTTPS Drupal 8 site

    Step 3: Verifying Certbot Auto-Renewal

    Let’s Encrypt’s certificates are only valid for ninety days. This is to encourage users to automate their certificate renewal process. The certbot package we installed takes care of this for us by adding a renew script to /etc/cron.d. This script runs twice a day and will automatically renew any certificate that’s within thirty days of expiration.

    To test the renewal process, you can do a dry run with certbot:

    sudo certbot renew --dry-run

    If you see no errors, you’re all set. When necessary, Certbot will renew your certificates and reload Nginx to pick up the changes. If the automated renewal process ever fails, Let’s Encrypt will send a message to the email you specified, warning you when your certificate is about to expire.


    How to Install Drupal 8 with Nginx, PHP-FPM 7.2, MySQL, phpMyAdmin on Ubuntu 18.04 - Linode Guide

    | Servers | 68 seen

    In this article, you will learn how to setup Drupal 8 with Nginx, PHP-FPM 7.2, MySQL and phpMyAdmin on Ubuntu 18.04

    For the following tutorial, I used very much the information from my previous guide with Ubuntu 16.04, but decided to rewrite it for Ubuntu 18.04 version as when I tried to setup my latest project about stock trading 0dtespxtrading.com  with Drupal 8.8.5  on Ubunut 16.04 machine an error from Drupal that PHP version shipped with Ubuntu 16.04   was outdated and instead of upgrading that box I decided to go with a new server from scratch, 

    Prerequisites

    • Ubuntu 18.04 
    • Root privileges.

    You can get a cheap VPS starting just $5/mo from Linode. That's what I did - bought a new nanode from Linode

    Deploying server with Linode

    Literally in couple of seconds the new server was up and running - that's what I love sticking with Linode for years

    Follow basic security guide, see: Securing Your Server

    I will use Putty for Windows to access SSH

    Secure your server

    Create the user, replacing example_user with your desired username. You’ll then be asked to assign the user a password:

    adduser example_user


    Add the user to the sudo group so you’ll have administrative privileges:

    adduser example_user sudo

    Disallow root logins over SSH. This requires all SSH connections be by non-root users. Once a limited user account is connected, administrative privileges are accessible either by using sudo or changing to a root shell using su -.

    sudo nano /etc/ssh/sshd_config

    Under # Authetification section change to

    # Authentication: ... PermitRootLogin no

    Update the Ubuntu system

    sudo apt-get update

    Install Nginx and PHP-FPM

    Install Nginx with the following apt command:

    sudo apt-get install nginx -y

    Next, install php7.0-fpm with php-gd extension that is required by Drupal core:

    sudo apt-get install php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml -y

    Configure Nginx and PHP-FPM

    In this step, we will configure Nginx to use php-fpm to serve HTTP requests for PHP pages. Go to the php-fpm directory "/etc/php/7.0/fpm" and edit the "php.ini" file:

    sudo nano /etc/php/7.2/fpm/php.ini

    Un-comment the cgi.fix_pathinfo line and change the value to "0"

    When using nano command you can use CTRL+W to locate that line. Once changed press CTRL+O to save changes and CTRL+X to exit from nano editor

    Now we should modify the default Nginx virtual host configuration. Edit the "default" file and enable the php-fpm directive.

    sudo nano /etc/nginx/sites-available/default

    Un-comment  location ~ \.php$ section, so it look like this

    location ~ \.php$ { include snippets/fastcgi-php.conf; # With php7.0-cgi alone: #fastcgi_pass 127.0.0.1:9000; # With php7.0-fpm: fastcgi_pass unix:/run/php/php7.2-fpm.sock; }

    CTRL+O and CTRL+X

    Then test the Nginx configuration with the command "nginx -t" to ensure that it is valid:

    nginx -t

    If there is no error, restart nginx and the php-fpm service:

    systemctl restart nginx systemctl restart php7.2-fpm

    PHP Info file (Optional)

    Next, test that php-fpm is working properly with nginx by creating new php info file in the web directory "/var/www/html"

    cd /var/www/html/ echo "<?php phpinfo(); ?>" > info.php

    Visit the info.php file at the server IP  in a web browser.

    Configure the VirtualHost for Drupal

    We will install Drupal 8 in the directory "/srv/www/0dtespxtrading.com". Please replace my domain name in your installation with the domain name of the website that you want to use this Drupal installation for. So let's create the directory:

    sudo mkdir -p /srv/www/0dtespxtrading.com/{public_html,logs} sudo usermod -a -G www-data admin sudo chown -R www-data:www-data /srv/www sudo chmod -R 775 /srv/www sudo nano /etc/nginx/sites-available/0dtespxtrading.com

    Paste the Nginx configuration for Drupal 8:

    server { server_name 0dtespxtrading.com; root /srv/www/0dtespxtrading.com/public_html; ## <-- Your only path $ access_log /srv/www/0dtespxtrading.com/logs/access.log; error_log /srv/www/0dtespxtrading.com/logs/error.log; listen 80; listen [::]:80; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Very rarely should these ever be accessed outside of your lan location ~* \.(txt|log)$ { allow 192.168.0.0/16; deny all; } location ~ \..*/.*\.php$ { return 403; } location ~ ^/sites/.*/private/ { return 403; } # Block access to "hidden" files and directories whose names begin with a # period. This includes directories used by version control systems such # as Subversion or Git to store control files. location ~ (^|/)\. { return 403; } location / { # try_files $uri @rewrite; # For Drupal <= 6 try_files $uri /index.php?$query_string; # For Drupal >= 7 } location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; } # In Drupal 8, we must also match new paths where the '.php' appears in the middle, # such as update.php/selection. The rule we use is strict, and only allows this pattern # with the update.php front controller. This allows legacy path aliases in the form of # blog/index.php/legacy-path to continue to route to Drupal nodes. If you do not have # any paths like that, then you might prefer to use a laxer rule, such as: # location ~ \.php(/|$) { # The laxer rule will continue to work if Drupal uses this new URL pattern with front # controllers other than update.php in a future release. location ~ '\.php$|^/update.php' { fastcgi_split_path_info ^(.+?\.php)(|/.*)$; #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini include fastcgi_params; include snippets/fastcgi-php.conf; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_intercept_errors on; fastcgi_pass unix:/run/php/php7.2-fpm.sock; } # Fighting with Styles? This little gem is amazing. # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6 location ~ ^/sites/.*/files/styles/ { # For Drpal >= 7 try_files $uri @rewrite; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }

    CTRL+O and CTRL + X

    The Drupal virtual host file has been created, now we have to activate it by creating a symlink to the file in the "sites-enabled" directory:

    ln -s /etc/nginx/sites-available/0dtespxtrading.com /etc/nginx/sites-enabled/

    Test the Nginx configuration and if there is no errors restart Nginx:

    nginx -t systemctl restart nginx

    Install MySQL

    sudo apt-get install mysql-server ​sudo mysql_secure_installation

    Install phpMyAdmin

    sudo apt-get install phpmyadmin

    Hit ESC when the installation prompts you for auto-configuration, because there is no option for Nginx.

    Make an easy accessible symlink

    sudo ln -s /usr/share/phpmyadmin/ /srv/www/reinisfischer.com/public_html/phpmyadmin

    Install and Configure Drupal

    Enter the directory that we created earlier and download Drupal with wget. I'm using the latest Drupal 8.8.7]5. release as of April 23, 2020, make sure you are downloading latest version by visiting Drupal 8 download page and writing down the last numbers (version)

    cd /srv/www/0dtespxtrading.com sudo wget https://ftp.drupal.org/files/projects/drupal-8.8.5.tar.gz sudo tar -xvzf drupal-8.8.5.tar.gz sudo cp drupal-8.8.5/* public_html/ -R sudo chown www-data:www-data public_html -R

    Now visit your Drupal site in the web Browser, you should see following screen

    Drupal 8 welcome screen

    Now, it's just time to connect database and set up your Drupal 8 website


    April 2020 Dividend Income Report - $78.40

    | Investments | 16 seen

    Welcome to the thirty-sixth (#36) dividend income report, covering earnings I've made from dividend-paying stocks and peer to peer lending in April 2020.

    Last April we spent in a self-isolation (because of Covid-19) here in Georgia. Baby girl is doing her online class, learning about animals, shapes, continents, and even planets. Quite fascinating what a 21-month-old can do. Development is very rapid.

    King Davids Tower (s) in Tbilisi

    It was on the evening of April 27, 2020, I decided to switch glass (from the kit lens to telephoto) and make some photo for the month of April to put in the description for the monthly dividend income report.

    From the perspective of the market, last April was quite good, we recovered some 15% from the lost value, but still are under the water. From the perspective of dividends - this was a complete disaster - most ot the dividends were trimmed, some cut down to 0. Before the World's health crisis is was planned to take about $230 in dividends last April, but we managed to book only $78.40.

    That's one of the worst dividend months in years - the sad news, this is not over - it will take many months, if not years to recover.

    Compared to the previous April in 2019, that is a decrease of -52.26% (-$85.84)

    Options trades helped a little to offset the losses, but also were nothing impressive - I made some money with calls and puts, but lost some money with vertical spreads. At the end of the month, we were able to book $41.33 from options trades. 

    For a now I have decided to pause my adventures with crypto options, but I made some $9.28 last month

    When counted all together (dividends + options + crypto options), it seems I have made $129.01 in total last month. Effective income yield last April was 0.76% (about 9.12% annually) Which is humble for me, but anything positive in these times is good.

    One of my monthly goals is to generate at least 2.5% income yield from a portfolio. Let's see, can I get on the track in the futures months (Spoiler alert - the only way I see this happen is from option trading

    Interest income in April 2020

    From the stocks and peer to peer lending I got following income last month:

    Ticker

    Earnings

    EDI

    €27.26

    EDF

    €21.33

    Mintos

    €8.09

    RA

    €7.81

    NCV

    €3.88

    AWP

    €3.76

    Total EUR 71.83 / USD 78.40

    In total there were 6 companies paying us dividend in April 2020 that 5 companies less than in April 2020

    We didn't get payments this April from, NRZ (dividend will be paid in May, but is cut by 90%), PNNT (we still hold the stock, but our stock was sold on div ex-day back in March, so we didn't qualify for a dividend this April, hopefully, things will get better in July.

    If things were at the pre-COVID-19, we would collect at least $138.45 from NRZ and PNNT, but we didn't.

    Monthly income

    I've been tracking my journey towards million dollars in a savings account since January 2017.  More than three years already. The result for 2020 is lagging behind

    in 3 out of 4 months this year, the dividend income has been lower than in 2019

    Monthly dividend Income chart as of April 2020

    The cumulative dividend earnings for 2020 now are $657.55  which is exactly 18.27% from my goal of 2020 ($3,600). On average, it would ask me to generate $367.81 every month for the next 8 months to reach my goal. With 90% confidence, I'm saying this goal won't be reached this year.

    2019 in Review and Financial Goals for 2020

    Goals for April 2021

    This is my favorite part of the reports - trying to forecast/set goals for the next year. But before setting a goal for 2020, let's see what I forecasted/said a year ago (April 2019)

    When setting goals for April 2020, I will say I want to increase dividend income by at least $70 - it translates in $234. Let's keep an odd number. I like them. lol

    Wow, a total failure. I wasn't' smart enough to build Covid-19 proof dividend portfolio and instead of an increase of $70, we are now experiencing a decrease of more than $80.

    When setting goals for 2021 - I will say anything above $200 will be a great result. To get there it will ask a lot of smart investments and a lot of cash deployed