📜 ⬆️ ⬇️

1C-Bitrix on Raspberry Pi 2

Our colleagues and partners, the web studio Oroblanko, decided to make an interesting experiment: run 1C-Bitrix on the Raspberry Pi 2 microcomputer. What we wrote about in detail on our blog . With their kind permission we publish the results. :)

* * *

Just say why we need it.
')
Understand whether it is possible at all. Ensure that the Raspberry Pi 2 is a computer, not a toy.

Understand how fast and stable Bitrix will work on such a weak computer (and whether it will work at all).

Confirm your own qualifications of specialists in setting up servers, because the task is not trivial.

If everything works out, then we will dispel the old legend that “Bitrix is ​​heavy, slow and cumbersome” and that it needs large computational resources.

Some time ago we bought a Raspberry Pi 2 , collected it and connected it to a TV. The machine seemed quite brisk, onboard 1 GB of memory and a quad-core processor plus Debian, which in the version for Raspberry is called Raspbian. And since we are certified partners of 1C-Bitrix, our hands were itching to cross Raspberry with Bitrix and see what happens.

We chose the pure form of the experiment using the Raspberry Pi 2 in the default configuration and did not connect additional HDD or SSD to the computer, leaving MicroSD as the main carrier, and for us to have more fun and the computer would not be bored, take the most “heavy” Bitrix configuration. Editorial "Business" and the decision "online store". So that immediately, as they say, a sledgehammer on the head.

SD cards - specific carrier. The most time-consuming operation is recording. The memory card is not the slowest, in addition, this moment is taken into account in Raspbian and all user write operations to disk are cached in RAM (delayed write), so from the user's point of view everything “flies”. But how will the machine work with writing to the card in the server configuration? We do not know. But we will try.

We also understood that apache + mysqld is a resource-intensive piece, and under load there is a real overflow of RAM, the system will start using a swap and will “sit on the disk”, as a result the server will “lie down”. Therefore, we immediately relied on nginx and Beatrix composite operation mode, which will minimize our risks.

Getting started


We put on a typewriter regular Raspbian and Midnight Commander for convenience. Raspbian is chosen for the lack of glitches and maximum lickiness and stability. Disable graphics mode (X server) to save resources. Then we do everything through SSH.

Be sure to execute commands

apt-get update apt-get upgrade 

It turned out to be important. If you do not upgrade the packages, then memcached and nginx will be crooked, and we are faced with this.

We put Bitrix


Download the installer web environment.

 wget http://repos.1c-bitrix.ru/yum/bitrix-env.sh chmod +x bitrix-env.sh ./bitrix-env.sh 

The script says, “What kind of crap do you give me?” And falls out. Look what's wrong. Yeah, first of all the script checks that it is run on a system that supports the x86 command set. And we him ARM slipped. Well, okay, people who dealt with the EU-1040 and DEC VAX, do not frighten. The script, we did not rule. We put everything manually, open the necessary ports.

What we put:


Nginx and memcached are not yet installed, as it is interesting to see how it will work on a pure Apache.

Download the Bitrix distribution and start the installation process. It is still put!

Interesting


So, at us on Raspberry Pi 2 the Bitrix, on the pure Apache, without nginx and memcached was got. We connect caching of APC. So, APC for Raspbian works in Emulated mode. That is, it seems to be there for those who need it, but in fact it does not exist. Therefore, in fact, it does not increase the speed of the site.

Another interesting thing. Memcached in Raspbian does not allow to work with sockets. No matter how you customize, do not register. It does not create a socket, even burst. The only way to use memcached is to access the stub 127.0.0.1.

Overclocking needs to be turned off. It leads to unstable operation and freezing of the computer. It is necessary to set the default frequency of 900 MHz.

Performance


The performance bar of Bitrix when testing on a pure Apache produces 6.5 - 7.0 “parrots”, which is generally not so bad. On some commercial hosting there are such indicators. But it is interesting that after connecting memcached, the speedometer “drops” to 3.5 - 4.0 “parrots”, although memcached really speeds up the site. What is the reason for this behavior of the speedometer is not clear. Also here - interesting.



Apache for Raspbian is not optimized in any way. Which leads to a bunch of hanging processes and memory overflow. Therefore, we had to correct the settings by limiting the number of servers and the consumption of RAM.

MySQL also required tuning to optimize the server for memory and performance.

In general, the system works, but it is obviously hard. Let's see how things change with nginx.

Overclocking


As I already mentioned, before installing nginx, you need to upgrade the system. Otherwise, nginx is set up crookedly and, interestingly, the Apache is knocked out. Therefore, we had two iterations of the installation. Without the update system and with the update.

After installing nginx, of course, we configure the frontend and backend (two-tier architecture), turn on the composite mode in Bitrix and tune the nginx settings, giving it all the pictures and ready html files from the composite cache.

We enable CDN in Bitrix settings in order to maximally unload the server and bring all possible statics out.

After connecting nginx and accumulating the composite cache, the site starts to work very quickly. Like this:



Finalize


We forward the port through NAT to see the server outside and hang it on the domain. We check the security scanner, set up proactive protection and run tests of the quality monitor. We configure the backup of the entire system to an external Synology server and put our microserver on external monitoring. The average memory consumption of the system is 400-700 MB. While normal flight.







Results


We did it! And it seems like nobody except us was perverted, we are the first in the world.

Bitrix can work on anything, a proven fact.

For normal performance, the following are required: composite mode, nginx, and apache + mysqld configuration.

Even on Raspberry, the Bitrix can work fast.

Project configuration


1C-Bitrix, edited "Business" + solution "Online Store".

Composite caching and CDN for static content are enabled.

Computer

Raspberry pi 2

Broadcom BCM2836 quad-core ARMv7 processor

1GB RAM

Media - Micro SD card 32 GB

The channel speed is 30 Mbit / s or less.

Os raspbian

Poke the mouse or finger on the site on Bitrix and Raspberry Pi 2 here (raspberry.oroblanco.ru) .



Author: Dmitry Ivanov

Original: www.oroblancostudio.com/ru/blog/1c-bitrix-on-raspberry-pi-2.html

Source: https://habr.com/ru/post/276409/


All Articles