Uncategorized Archives - Sergey Lysenko https://sergey-lysenko.com/category/uncategorized/ The DevOps Engineer Sat, 13 Nov 2021 16:03:34 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.1 WordPress slow 404 at Apache https://sergey-lysenko.com/wordpress-slow-404-at-apache/ https://sergey-lysenko.com/wordpress-slow-404-at-apache/#respond Mon, 20 Sep 2021 06:30:56 +0000 https://sergey-lysenko.com/?p=113 After installing WordPress, you should definitely do a basic performance check. You should at least watch the logs and run Htop (or just Top). When you look at the access_log, you can find many 404 errors that need to be fixed. After you’ve fixed 404 errors, you need to make sure that if they reappear, […]

The post WordPress slow 404 at Apache appeared first on Sergey Lysenko.

]]>
After installing WordPress, you should definitely do a basic performance check. You should at least watch the logs and run Htop (or just Top). When you look at the access_log, you can find many 404 errors that need to be fixed.

After you’ve fixed 404 errors, you need to make sure that if they reappear, they won’t take up a lot of server resources.

Let’s take Apache as an example. With the default WordPress installation, there is no check whether a static resource file (image or script) exists or not. If the file doesn’t exist, the default WordPress 404 page is rendered. But 404 pages are not cached, and if you have a lot of such 404 responses on static, the server will waste a lot of resources.

Therefore, you need to add a configuration that will check whether the file exists or not, and if it does not exist, it will quickly give a 404 response at the Apache level. Each time you install WordPress on Apache, add the following to the virtual host level in the configuration:

<IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond /var/www/html%{REQUEST_FILENAME} !-f
      RewriteRule \.(css|js|ico|gif|jpg|jpeg|png|swf|flv|pdf|map|mov|svg|mp4|mp3|zip|eot|ttf|woff|woff2|ttc|otf)$ - [nocase,redirect=404,last]
</IfModule>

Pay attention to RewriteCond. There /var/www/html is the directory where your site is located. Replace with your own if the site is located elsewhere.

This rule checks if the file does not exist, then there is an instant 404 response without any resource consumption. This way you can significantly improve the performance of WordPress, the site will load faster.

The post WordPress slow 404 at Apache appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/wordpress-slow-404-at-apache/feed/ 0
Teams notifications not working at macOS https://sergey-lysenko.com/teams-notifications-not-working-at-macos/ https://sergey-lysenko.com/teams-notifications-not-working-at-macos/#respond Sat, 07 Aug 2021 05:15:26 +0000 https://sergey-lysenko.com/?p=101 You may have noticed that after the update, Teams stopped showing the number of unread messages in the icon in the Dock. Also, Teams is not present in the notification center. It is absent there, so it cannot be configured in any way. This is handled within the Teams app. In Teams settings, go to […]

The post Teams notifications not working at macOS appeared first on Sergey Lysenko.

]]>
You may have noticed that after the update, Teams stopped showing the number of unread messages in the icon in the Dock. Also, Teams is not present in the notification center. It is absent there, so it cannot be configured in any way.

This is handled within the Teams app. In Teams settings, go to Notifications and select Notification style = Mac. Previously, it can be set to Teams built-in.

Teams notification settings

After you select a Mac, a notification will appear informing you that you need to configure the permissions. Click on it, and you will immediately be taken to the Notification center. There you will see Teams has appeared and you can set up notifications for it.

Notifications center with Teams

Now you will see the count of unread messages at the Dock.

The count of unread messages

The post Teams notifications not working at macOS appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/teams-notifications-not-working-at-macos/feed/ 0
Transfer of domains between OVH accounts https://sergey-lysenko.com/transfer-of-domains-between-ovh-accounts/ https://sergey-lysenko.com/transfer-of-domains-between-ovh-accounts/#respond Wed, 07 Jul 2021 08:15:00 +0000 https://sergey-lysenko.com/?p=98 For those who don’t know, OVH is such a large and well-known French cloud provider. If you need to transfer a domain from one OVH client to another, then you do not need to go through the standard transfer procedure. OVH does this by changing the contact for the service. Algorithm of actions for transferring […]

The post Transfer of domains between OVH accounts appeared first on Sergey Lysenko.

]]>
For those who don’t know, OVH is such a large and well-known French cloud provider. If you need to transfer a domain from one OVH client to another, then you do not need to go through the standard transfer procedure. OVH does this by changing the contact for the service.

Algorithm of actions for transferring a domain inside OVH
1) request to change a contact in the contacts section. Specify the account ID where we want to transfer.
2) emails will be sent to the recipient, they will contain codes. Log in to the recipient’s account and enter these codes
3) after that, the codes will come to the transmitter, also log in to the transmitter’s account and enter the codes

So, the domain is transferred

The post Transfer of domains between OVH accounts appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/transfer-of-domains-between-ovh-accounts/feed/ 0
Cleanup the suppression list at AWS SES https://sergey-lysenko.com/cleanup-the-suppression-list-at-aws-ses/ https://sergey-lysenko.com/cleanup-the-suppression-list-at-aws-ses/#comments Sat, 20 Feb 2021 15:23:50 +0000 https://sergey-lysenko.com/?p=86 Amazon Simple Email Service has a mechanism to prevent sending emails to addresses that bounced or complained. Sometimes the emails are bouncing because of the short time server failures. And if the email is added to the suppression list, this address will never receive an email from you. AWS has a cli to manipulate with […]

The post Cleanup the suppression list at AWS SES appeared first on Sergey Lysenko.

]]>
Amazon Simple Email Service has a mechanism to prevent sending emails to addresses that bounced or complained. Sometimes the emails are bouncing because of the short time server failures. And if the email is added to the suppression list, this address will never receive an email from you.

AWS has a cli to manipulate with this list. But there is no command to clean up all items on the list. It is designed to remove the items one by one.

Here are the useful commands to watch, save and purge all the suppression list:

# Save the list to file
aws sesv2 list-suppressed-destinations --no-paginate > list.txt

# Watch the entire list of emails
aws sesv2 list-suppressed-destinations --no-paginate | grep -o '"EmailAddress": "[^"]*' | grep -o '[^"]*$'

# Purge the suppression list
for email in $(aws sesv2 list-suppressed-destinations --no-paginate | grep -o '"EmailAddress": "[^"]*' | grep -o '[^"]*$'); do aws sesv2 delete-suppressed-destination --email-address ${email}; echo ${email}; sleep 1; done

The post Cleanup the suppression list at AWS SES appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/cleanup-the-suppression-list-at-aws-ses/feed/ 2
Speedup Docker attached volumes at Mac https://sergey-lysenko.com/speedup-docker-attached-volumes-at-mac/ https://sergey-lysenko.com/speedup-docker-attached-volumes-at-mac/#respond Thu, 21 Jan 2021 12:20:46 +0000 https://sergey-lysenko.com/?p=79 When you are using Docker at Mac for development, you may be noticed, that the speed of the attached volume is horrifically slow. To cut a long story short, it is due to the way a Docker virtual machine works on a Mac. The best way to speed up the attached Docker volume at Mac, […]

The post Speedup Docker attached volumes at Mac appeared first on Sergey Lysenko.

]]>
When you are using Docker at Mac for development, you may be noticed, that the speed of the attached volume is horrifically slow. To cut a long story short, it is due to the way a Docker virtual machine works on a Mac.

The best way to speed up the attached Docker volume at Mac, for now, is to use NFS.

It is very simple, you should edit two files: /etc/nfs.conf and /etc/exports.

sudo nano /etc/nfs.conf

By default, it contains:

#
# nfs.conf: the NFS configuration file
#

Add a string there:

nfs.server.mount.require_resv_port = 0

Then edit the /etc/exports file, by default it is empty.

sudo nano /etc/exports

Add there:

<path to your dir for NFS sharing> -alldirs -mapall=501:20 localhost

Here the “path to your dir for NFS sharing” is just a path to some folder you are using for development and where the contents of your volume are located.

Next, just restart the NFS service:

sudo nfsd restart

Then make some modifications to your docker-compose.yml:

version: '2'
services:
  magento:
    ...
    volumes:
      - nfsmount:/var/www/html

volumes:
  nfsmount:
    driver: local
    driver_opts:
      type: nfs
      o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
      device: ":<absolute path to your data to mount>"

I have measured the speed of the attached volume with and without NFS:

# Command to run test
dd if=/dev/zero of=file.txt count=512000 bs=1024 && rm file.txt

# Without NFS, cached
512000+0 records in
512000+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 218.471 s, 2.4 MB/s

# With NFS
512000+0 records in
512000+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 7.61804 s, 68.8 MB/s

As you can see, with NFS you gain 28X mounted-storage performance using Docker on Mac.

The post Speedup Docker attached volumes at Mac appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/speedup-docker-attached-volumes-at-mac/feed/ 0
Bash – generate a random number of a given range https://sergey-lysenko.com/bash-generate-a-random-number-of-a-given-range/ https://sergey-lysenko.com/bash-generate-a-random-number-of-a-given-range/#respond Mon, 14 Dec 2020 11:15:11 +0000 https://sergey-lysenko.com/?p=74 You can generate a random number in bash using this snippet:

The post Bash – generate a random number of a given range appeared first on Sergey Lysenko.

]]>
You can generate a random number in bash using this snippet:

RAND=$(shuf -i 7000-7999 -n 1)

The post Bash – generate a random number of a given range appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/bash-generate-a-random-number-of-a-given-range/feed/ 0
How to purge MySQL 8 binary logs https://sergey-lysenko.com/how-to-purge-mysql-8-binary-logs/ https://sergey-lysenko.com/how-to-purge-mysql-8-binary-logs/#respond Tue, 01 Dec 2020 07:49:50 +0000 https://sergey-lysenko.com/?p=71 You saw, that your mysql disk, using /var/lib/mysql is full. So, you need to know how to free some space and clean up the disk. Usually, you can safely remove the old binlogs. First of all, you should login to MySQL server and check if there are some binlog files. If you see something like […]

The post How to purge MySQL 8 binary logs appeared first on Sergey Lysenko.

]]>
You saw, that your mysql disk, using /var/lib/mysql is full. So, you need to know how to free some space and clean up the disk. Usually, you can safely remove the old binlogs.

First of all, you should login to MySQL server and check if there are some binlog files. If you see something like this, they are:

sh-4.2$ ls -la /var/lib/mysql | grep binlog
-rw-rw----. 1 1001230000 1001230000    2959368 Nov  5 04:56 binlog.000001
-rw-rw----. 1 1001230000 1001230000 1074256888 Nov  5 05:04 binlog.000002
-rw-rw----. 1 1001230000 1001230000  623916528 Nov  5 05:12 binlog.000003
-rw-rw----. 1 1001230000 1001230000   16797561 Nov  5 12:57 binlog.000004
-rw-rw----. 1 1001230000 1001230000  385788866 Nov  9 12:38 binlog.000005
-rw-rw----. 1 1001230000 1001230000  484322047 Nov  9 15:16 binlog.000006
-rw-rw----. 1 1001230000 1001230000  424167115 Nov 10 14:04 binlog.000007
-rw-rw----. 1 1001230000 1001230000   58027474 Nov 10 20:00 binlog.000008
-rw-rw----. 1 1001230000 1001230000   13217008 Nov 11 20:00 binlog.000009
-rw-rw----. 1 1001230000 1001230000        179 Nov 11 21:31 binlog.000010
-rw-rw----. 1 1001230000 1001230000   13285404 Nov 12 20:00 binlog.000011
-rw-rw----. 1 1001230000 1001230000   13241773 Nov 13 20:00 binlog.000012
-rw-rw----. 1 1001230000 1001230000      34779 Nov 16 20:00 binlog.000013
-rw-rw----. 1 1001230000 1001230000  359932796 Nov 17 20:00 binlog.000014
-rw-rw----. 1 1001230000 1001230000   22423233 Nov 18 20:00 binlog.000015
-rw-rw----. 1 1001230000 1001230000   86190929 Nov 19 20:00 binlog.000016
-rw-rw----. 1 1001230000 1001230000   39029607 Nov 20 20:00 binlog.000017
-rw-rw----. 1 1001230000 1001230000  101916333 Nov 23 20:00 binlog.000018
-rw-rw----. 1 1001230000 1001230000   32958639 Nov 24 20:00 binlog.000019
-rw-rw----. 1 1001230000 1001230000   40808525 Nov 25 20:00 binlog.000020
-rw-rw----. 1 1001230000 1001230000   40866887 Nov 26 20:00 binlog.000021
-rw-r-----. 1 1001230000 1001230000        156 Dec  1 08:37 binlog.000022
-rw-r-----. 1 1001230000 1001230000        352 Dec  1 08:37 binlog.index

By default, MySQL rotates binlogs and stores them for 30 days. You can reduce this parameter by setting up this parameter at mysqld.cnf:

binlog_expire_logs_seconds = 432000

The value is in seconds, so 432000 means 5 days. You should restart MySQL to apply the settings.

After that you can cleanup old logs. Do not delete files, but login to your MySQL server and execute this query to remove all binlogs:

PURGE BINARY LOGS BEFORE NOW();

All the logs will be purged. As you can see, you can insert your own date here to cleanup not all binlogs, but before a certain date.

The post How to purge MySQL 8 binary logs appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/how-to-purge-mysql-8-binary-logs/feed/ 0
“error : Wrong bytesec: 0-0-0 at linkstart: 0” at MyISAM https://sergey-lysenko.com/error-wrong-bytesec-0-0-0-at-linkstart-0-at-myisam/ https://sergey-lysenko.com/error-wrong-bytesec-0-0-0-at-linkstart-0-at-myisam/#respond Wed, 11 Nov 2020 08:34:03 +0000 https://sergey-lysenko.com/?p=62 Sometimes you could not create Mysql dump because one or several tables corrupted. Then obviously it should be somehow restored. The Mysql and Maria have some standard tools for restoring crashed tables. When creating a dump, Mysql says which MyISAM table is corrupted. So you can execute this to take the proof: Then you can […]

The post “error : Wrong bytesec: 0-0-0 at linkstart: 0” at MyISAM appeared first on Sergey Lysenko.

]]>
Sometimes you could not create Mysql dump because one or several tables corrupted. Then obviously it should be somehow restored. The Mysql and Maria have some standard tools for restoring crashed tables.

When creating a dump, Mysql says which MyISAM table is corrupted. So you can execute this to take the proof:

myisamchk /var/lib/mysql/data/dbname/tablename.MYI

Then you can restore it. But before that do not forget to create the backup:

cp /var/lib/mysql/data/dbname/tablename.MYI /var/lib/mysql/data/dbname/tablename.MYI-bak

By the way, to check all the MyISAM tables for errors, you can use the star mark:

myisamchk /var/lib/mysql/data/dbname/*.MYI

To restore the table, shutdown the mysql daemon and execute myisamchk with -r key:

myisamchk -r /var/lib/mysql/data/dbname/tablename.MYI

Then you can start the Mysql daemon and use the database as usual.

You can also use mysqlcheck command to check and repair table or the entire database:

# to check table
mysqlcheck -c -u root -p'password' -h mysqlhost dbname tablename
# to repair table
mysqlcheck -r -u root -p'password' -h mysqlhost dbname tablename
# to repair database
mysqlcheck -r -u root -p'password' -h mysqlhost dbname

As you can see, it uses a host, so mysqlcheck command needs the daemon to be running.

The post “error : Wrong bytesec: 0-0-0 at linkstart: 0” at MyISAM appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/error-wrong-bytesec-0-0-0-at-linkstart-0-at-myisam/feed/ 0
Android System, Sign in to network, Use this network as is https://sergey-lysenko.com/android-system-sign-in-to-network-use-this-network-as-is/ https://sergey-lysenko.com/android-system-sign-in-to-network-use-this-network-as-is/#comments Sat, 17 Oct 2020 11:42:44 +0000 https://sergey-lysenko.com/?p=34 Do you also get this annoying notification that you need to sign in to the network? It is not only annoying but also indicates that the Internet connection is actually broken. And you cannot receive any messages, you cannot use the Internet at all. You need constantly press the Use this network as is option. […]

The post Android System, Sign in to network, Use this network as is appeared first on Sergey Lysenko.

]]>
Do you also get this annoying notification that you need to sign in to the network? It is not only annoying but also indicates that the Internet connection is actually broken. And you cannot receive any messages, you cannot use the Internet at all. You need constantly press the Use this network as is option. This is very annoying.

It looks like this:

The reason is that the phone is constantly checking the Internet connection. It pings some URL, and any vendor (Xiaomi, Yandex, Samsung, etc) can set there its own URL. Sometimes vendor’s URL may be broken and not available. Then the phone thinks that something happened with the connection and throws Sign in to network window. This window usually needed when using sign in required networks, for example, in malls or subways. But if we really do not need signing in, the white blank screen appears.

No reboots and factory resets help. Fortunately, there is a solution! You will need any computer. I am using Mac.

Install android-platform-tools via homebrew:

brew cask install android-platform-tools

If you are not using Mac, here is the platform tools installation instruction for all the systems.

Check if it is working at command line:

Sergeys-iMac:~ sergey$ adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached

It said, that we have no devices connected. So let’s connect. You should enable USB-debugging on the phone, and attach it to the computer via USB. Check again to get your phone listed as connected:

Sergeys-iMac:~ sergey$ adb devices
List of devices attached
Y018B1500253    device

Then just execute these commands:

adb shell 'settings put global captive_portal_http_url "http://www.google.com/generate_204"'
adb shell 'settings put global captive_portal_https_url "https://www.google.com/generate_204"'

As you can see, it sets up the standard Google’s URLs for the captive portal. You can also read about captive portals, but is not necessary for our issue.

Now detach your phone from USB and reboot. It worked! You do not need to sign in, your phone works like old times.

The post Android System, Sign in to network, Use this network as is appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/android-system-sign-in-to-network-use-this-network-as-is/feed/ 1
Recommendations for Google images indexing https://sergey-lysenko.com/recommendations-for-google-images-indexing/ https://sergey-lysenko.com/recommendations-for-google-images-indexing/#respond Sun, 11 Oct 2020 14:13:28 +0000 https://sergey-lysenko.com/?p=14 Images on your site are very important, it has said a lot about already. Internet users often pay attention to the illustrated sites and ignore the ones where there is only the text. This article focuses on how to correctly place the images on your site that they are guaranteed to be indexed by Google […]

The post Recommendations for Google images indexing appeared first on Sergey Lysenko.

]]>
Images on your site are very important, it has said a lot about already. Internet users often pay attention to the illustrated sites and ignore the ones where there is only the text. This article focuses on how to correctly place the images on your site that they are guaranteed to be indexed by Google or Yandex.

If you want your images to appear in the pictures search, you need to observe the following rules:

If you want to index the gallery, then each individual image should have its own html-page with the appropriate title, meta description and other attributes as in the usual pages.

If a gallery works in the way the images are displayed in a beautiful pop-up window, you must provide alternate links for those who do not have JavaScript enabled. Among them are search engines, so they should be possible to switch to HTML-version of the page with the image. In addition, if there is no individual pages, search engines will not be able to take the description of the image, and, therefore, to show images in search results.

Make sure that the page with a picture (URL of the page and the image path itself) is not forbidden in robots.txt.

Some CMS have a standard robots.txt file, in which utilities folders are forbidden for indexing, including images folder. Even if you do not use any CMS, you still need to check to see if the image is not in the forbidden for indexing folder.

Disable indexing of auxiliary images: menu items, navigation buttons, and other graphic elements. Thumbnails of images also should be forbidden for indexing.

In order not to clutter up the search results by the meaningless images, you need to plan the structure of sections of your site. All kinds of utility images should be put into individual sections and prevented for indexing. If you do not, there will be many fragmented and useless images in the search results.

Name the image file appropriately.

Do not leave the default file name that is set by photo-camera. You need to rename the files in accordance with what they represented.

Specify the alt and title attributes for images.

Alt and title must be given a meaningful, short, human-understandable terms, without an overabundance of keywords. You can not leave an empty string (alt = “”).

Make sure that the quotes are escaped when you specify the alt and title.

If you use the automatic generation of pages with images, the names may contain some of the quotes, which demolish the page layout and will not allow the image be properly indexed. You need to escape quotes, or in extreme cases, cut them out completely.

If there is a link to an image, form it correctly.

Some pages may refer to the image, so the link must be coherent, understandable, and adequately describe what is shown in the picture. If the images are used instead of text links as it often happens in the navigation buttons of galleries, Google will take alt of the image as a caption to a picture in search results. Therefore, you must not specify an alt as the “Previous Image” and so on. The links must have a title, indicating the image the user to move when she clicks.

Specify the height and width of the image.

If you do not specify them, then users with turned off graphics will see a rectangle of small size. With specified dimensions, such a user will see the rectangle of corresponding dimensions, that will keep the page layout and logic. It should be remembered that there are various mobile browsers that can display images in a specific way.

Put an image as close as possible to the area of text to which it applies.

The image itself is better to be placed as high as possible, preferably in the first paragraph of the text. The text near the image should refer to what is shown. If a paragraph written about a squirrel and a duck will be drawn, that will be the way it indexed, which will lead to the loss of traffic.

Sign the image directly in the same block as the image itself.

You can not separate and place in different blocks the picture and accompanying caption to it. If in the paragraph (tag p) appears an image, the search robot expects to see a signature to the image immediately after the image in the same paragraph.

Ensure that the pages with images available for display in the frame of Google-images.

When displaying images in the search results, Google will display the page of this image in a frame in the background. If a page is not allowed to be shown in a frame, Google will simply fill the background by beige color, that’s ugly.

Do not place foreign, alien elements in the image.

If we are not talking about the scheme, the text in the image will be very annoying. This also applies to large and too prominent watermark. Customers are less likely to click on the picture in which they can see some foreign text.

Place pictures in high quality.

Users are more likely to click on the image with adequate resolution and quality, rather than on the small and poor quality.

Include information about the images in the sitemap (if it is generated), or use other means of automatic delivery of information about the images to search engines.

The post Recommendations for Google images indexing appeared first on Sergey Lysenko.

]]>
https://sergey-lysenko.com/recommendations-for-google-images-indexing/feed/ 0