Oro - assets building times out - orocommerce

We have problems building assets for oro version 4.x. Oro installation works fine and during installation it also succesfully builds assets (webpack). We have CICD pipeline and after every commit, we run following commands:
# Run composer install
composer install --prefer-dist --no-interaction --no-dev -vvv
# Remove cache
rm -rf /var/www/var/cache
php bin/console cache:warmup --no-interaction --env=prod -vvv
# Switch Oro to maintenance mode
php bin/console lexik:maintenance:lock --env=prod --no-interaction -vvv
# Set permissions
chown -R www-data:www-data /var/www/var
# Run migrations (first schema changes then fixtures)
php bin/console oro:migration:load --force --no-interaction -vvv
php bin/console oro:migration:data:load --no-interaction -vvv
php bin/console oro:migrations:data:storeroom:load --fixtures-type=storeroom
# Pricing recalculation
php bin/console oro:price-lists:recalculate --all
# Build assets
php bin/console oro:assets:install --env=prod --no-interaction -vvv
# Remove cache
rm -rf /var/www/var/cache
php bin/console cache:warmup --no-interaction --env=prod -vvv
It fails during "php bin/console oro:assets:install --env=prod --no-interaction -vvv", because of the timeout. It does not matter how much memory or cpu we allocate, or if we give it more time... It can consume 8gb memory and all CPU-s and keeps running for more than half an hour, it is then killed because of the timeout. During install this same command, takes about 2min to finish... What are we doing wrong?
EDIT: Increasing timeout does not help, it never finishes (we tried for an hour).

You can extend the build timeout for webpack build from config/config.yml file in the application.
oro_asset:
build_timeout: 1000
For more details, please check documentation on OroAssetBundle.

Related

Why is brew install redis not working for mac M1?

I have to install redis, but it is not working to install redis anymore using brew. Getting the following error when trying to install this way:
Warning: No available formula with the name "redis".
==> Searching for similarly named formulae and casks...
==> Casks
another-redis-desktop-manager ✔ redis-pro
jpadilla-redis redisinsight
medis
To install another-redis-desktop-manager ✔, run:
brew install --cask another-redis-desktop-manager ✔
Tried the command brew install --cask another-redis-desktop-manager.
This also didn't work.
Actually found the answer. Basically the reason for the failure in installation was because the core homebrew packages were not correctly configured.
Identified the issue with brew doctor
The solution was
rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
brew tap homebrew/core
ARM Homebrew must be installed in the /opt/homebrew directory. Earlier, you need to manually create directories and run commands. However, you do not need to manually run commands to use the latest scripts.
Direct execution:
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
PS: terminal type Run the echo $SHELL command. The command output is as follows:
/bin/bash => bash => .bash_profile
/bin/zsh => zsh => .zprofile
If you encounter invalid environment variables, you are advised to check the terminal type before setting the correct environment variables.
Starting with macOS Catalina(10.15.x), Macs use zsh as the default Shell, using.zprofile, so the corresponding command:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
If you have macOS Mojave or later and have not configured zsh yourself, use.bash_profile:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"
Hope this can help you

Cannot start apache automatically with docker

I made a simple custom docker setup for php development. So far everything works as expected. The only thing that I cannot figure out is why apache2 does not start automatically.
Here is my dockerfile:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y apache2 php libapache2-mod-php php-mcrypt php-mysql php-cli php-curl php-xml php-intl php-mbstring git vim composer curl
COPY . /var/www/example
COPY vhost.conf /etc/apache2/sites-available/example.conf
RUN a2ensite example
RUN chown -R www-data:www-data /var/www/example/logs
RUN service apache2 restart
And here is my docker-compose.yml:
version: '2'
services:
app:
build:
context: .
dockerfile: Dockerfile
image: myexampleapp
ports:
- 8080:80
tty: true
And here is the output docker-compose up command:
me#mydell:~/workspace/mydockercompose$ docker-compose up -d --build
Creating network "mydockercompose_default" with the default driver
Building app
Step 1/7 : FROM ubuntu:latest
---> f975c5035748
Step 2/7 : RUN apt-get update && apt-get install -y apache2 php libapache2-mod-php php-mcrypt php-mysql php-cli php-curl php-xml php-intl php-mbstring git vim composer curl
---> Using cache
---> 148c3a9d928a
Step 3/7 : COPY . /var/www/example
---> 1fbc1dbacf1e
Step 4/7 : COPY vhost.conf /etc/apache2/sites-available/example.conf
---> 9c08947b09e9
Step 5/7 : RUN a2ensite example
---> Running in 1ef64defe747
Enabling site example.
To activate the new configuration, you need to run:
service apache2 reload
Removing intermediate container 1ef64defe747
---> ca1c8e7e80fc
Step 6/7 : RUN chown -R www-data:www-data /var/www/example/logs
---> Running in 57b0214be7a0
Removing intermediate container 57b0214be7a0
---> b3b270a36bf4
Step 7/7 : RUN service apache2 restart
---> Running in 09d2b1d3bd91
* Restarting Apache httpd web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
...done.
Removing intermediate container 09d2b1d3bd91
---> 19fa9a90f9de
Successfully built 19fa9a90f9de
Successfully tagged myexampleapp:latest
Creating mydockercompose_app_1
It shows clearly that apache was restarted successfully. However it actually does not:
me#mydell:~/workspace/mydockercompose$ docker exec -i -t 20add8ad9895 service apache2 status
* apache2 is not running
I am new to docker, so all suggestions (even if they are not answering this specific question) to improve what I am doing so far are welcome.
Thanks
Docker services have to be running in the foreground. In your Dockerfile, RUN service apache2 restart will start apache as background process. Hence the container will exit.
To run apache in the foreground, add the following to the Dockerfile.
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
FROM ubuntu:latest
RUN apt-get update && apt-get install -y apache2 php libapache2-mod-php php-mcrypt php-mysql php-cli php-curl php-xml php-intl php-mbstring git vim composer curl
COPY . /var/www/example
COPY vhost.conf /etc/apache2/sites-available/example.conf
RUN a2ensite example
RUN chown -R www-data:www-data /var/www/example/logs
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
The above answer is probably correct that mentioned that you can start it with:
CMD apachectl -D FOREGROUND
With docker it is sometimes a good idea to use the absolute path to a binary. So for example maybe do this instead:
/usr/sbin/apache2 -D FOREGROUND
I had a look a bit on google to see what other people are doing. I found this example of a dockerfile where the guy mentions a script start.sh:
From here: https://github.com/jacksoncage/apache-docker/blob/master/Dockerfile
EXPOSE 80
ADD start.sh /start.sh
RUN chmod 0755 /start.sh
CMD ["bash", "start.sh"]
Here is the start.sh script: https://github.com/jacksoncage/apache-docker/blob/master/start.sh
Which simply just does:
#!/bin/bash
# Start apache
/usr/sbin/apache2 -D FOREGROUND
Unrelated tip:
Your dockerfile you need to pin the version for Ubuntu.
See: https://nickjanetakis.com/blog/docker-tip-18-please-pin-your-docker-image-versions
Let me know if this helps.
If it help you or anybody, i was preparing working example with complete docker-composer:
https://github.com/marekz/docker-composer-example
FROM ubuntu:18.04
EXPOSE 80
ENV TZ=Europe/Warsaw
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y libapache2-mod-php7.2 php7.2 php7.2-cli php7.2-gd php7.2-intl php7.2-mbstring php7.2-mysql php7.2-xml php7.2-xsl php7.2-bcmath php7.2-zip php-apcu npm lynx
RUN apt-get install -y mysql-client composer screen tmux vim nano iputils-ping
ENTRYPOINT service apache2 restart && bash
By analyzing the statements, I found a solution to my error
File: Dockerfile
FROM debian
RUN apt-get update -qq >/dev/null && apt-get install -y -qq procps telnet apache2 php7.3 -qq >/dev/null
RUN useradd --user-group --create-home --shell /bin/false app
RUN mkdir /data && chown -R app /data && chmod 777 /data
COPY php.conf /etc/apache2/mods-available/php7.3.conf
RUN a2enmod userdir && a2enmod php7.3
Error:
To activate the new configuration, you need to run:
service apache2 reload
Solutions:
FROM debian -> FROM debian:10
The reason was some conflict between the debian system and the php version. The latest version of debian has a newer version of PHP (PHP 7.4 at that time).

AWS EC2 standard AWS AMI with PHP 7.0 - install libsodium recipe

(edited for clarity - rolled in accepted answer)
Libsodium has been prepped for PHP 7. In doing this, the namespace was removed and a prefix of sodium_ for methods and SODIUM_ for constants was added. Also the version methods were removed.
This github page documents all the new functions and constants and the project provides backward compatibility with the \Sodium namespace: https://github.com/Firehed/sodium/blob/master/src/we_cant_have_nice_things.php
Recipe: install Libsodium on PHP 7 on and AWS AMI
# PHP 7.0 Libsodium install AWS AMI
yum install -y php7-pear re2c php70-devel
yum groupinstall -y "Development Tools"
pecl7 install libsodium
vi /etc/php-7.0.d/20-libsodium.ini
; Enable libsodium extension module
extension=sodium.so
service httpd restart
command line test to verify sodium is installed
php7 --info | grep sodium
test php function to verify calling pattern for password hash
<?php
$password = "hello";
$hash_str = sodium_crypto_pwhash_str(
$password,
\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
);
var_dump($password, $hash_str);
Thanks to #GracefulRestart for the help.
I see a couple problems here, the first is that your test file appears to be non-functional.
Running your test code with libsodium working in PHP 7 returns the following error:
PHP Fatal error: Uncaught Error: Call to undefined function Sodium\\library_version_major()
If you want to check the version, it may be easier to search the data from the phpinfo() function:
<?php phpinfo(); ?>
# or from CLI
php7 --info |grep sodium
The other problem I notice is in your install steps, you install libsodium both from source and from PECL. The make install command by default places the libraries in /usr/local/lib, while pecl7 install libsodium will normally install libraries into the default PHP modules directory.
If you were attempting to install from source, your /etc/php-7.0.d/20-libsodium.ini file is incorrect as that is loading the libsodium libraries you installed from PECL (you can check which directory it is loading from by check the extension_dir ini setting from phpinfo()).
If you only need to install from PECL, you do not need all of the development packages or any manual compiling.
EDIT I modified your posted recipe to remove the extraneous steps of downloading the source and just do everything with PECL:
yum install -y php7-pear re2c php70-devel
yum groupinstall -y "Development Tools"
# PHP 7.0
pecl7 install libsodium
vi /etc/php-7.0.d/20-libsodium.ini
; Enable libsodium extension module
extension=sodium.so
service httpd restart
If the YUM repositories for your distribution offer the php7-libsodium package, that would be an even smaller recipe
Hope that helps
Here's my solution to this recipe.
wget -c https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
tar -xvf libsodium-1.0.18.tar.gz
cd libsodium-1.0.18
./configure
make && make check
make install
sudo pecl7 install -f libsodium
pecl7 should install and modify the php.ini file to include the following in the php.ini
extension="sodium.so"
If you running PHP in Elastic Beanstalk, the following file ./ebextentions/script.config :
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/001_libsodium.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
wget -c https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz && tar -xvf libsodium-1.0.18.tar.gz && cd libsodium-1.0.18 && ./configure && make && make check && sudo make install && sudo pecl7 install -f libsodium

Build chromedriver for linux

I'm trying to build chromedriver from source for use in selenium for Linux.
i use this manual https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
but when i build without any error my chromedriver less for 2mb that if i download form google code site. and this chromedriver not work with selenium. just blank error.
Have someone any idea what wrong? Thank You
We'd need more information... Here is a dockerfile (largely taken from here) that worked for me. Most of the commands come from the chromium build docs.
FROM ubuntu:14.04
# Install Chromium build dependencies.
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty multiverse" >> /etc/apt/sources.list # && dpkg --add-architecture i386
RUN sudo apt-get update && apt-get install -qy git build-essential clang curl
# Install Chromium's depot_tools.
ENV DEPOT_TOOLS /usr/bin/depot_tools
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS
ENV PATH $PATH:$DEPOT_TOOLS
RUN echo -e "\n# Add Chromium's depot_tools to the PATH." >> .bashrc
RUN echo "export PATH=\"\$PATH:$DEPOT_TOOLS\"" >> .bashrc
RUN git config --global https.postBuffer 1048576000
# Download Chromium sources.
RUN fetch --nohooks --no-history chromium
WORKDIR /
RUN gclient runhooks
WORKDIR src
RUN build/install-build-deps.sh --no-prompt
RUN gn gen out/Release --args="is_debug=false"
RUN ninja -C out/Release chromedriver
RUN cp out/Release/chromedriver /usr/bin/chromedriver
WORKDIR /

PHP Fatal error: Class 'Phalcon\Script\Color' not found

I'm running Ubuntu Server 12.10 and have installed phalcon like this
sudo apt-get install php5-dev php5-mysql gcc git-core
git clone git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
then I've added
extension=/usr/lib/php5/20100525/phalcon.so
to php.ini which located in /etc/php5/apache2/php.ini and restarted apache2. If I execute
<?php print_r(get_loaded_extensions()); ?>
I can see that the phalcon extension is loaded. Then I've installed phalcon-devtools like that
git clone git://github.com/phalcon/phalcon-devtools.git
cd phalcon-devtools
sudo ./phalcon.sh
and restarted apache2. No errors were shown during that operations, but when I'm trying to execute
phalcon commands
I get an error like this
PHP Fatal error: Class 'Phalcon\Script\Color' not found in /home/user/phalcon-devtools/phalcon.php on line 84
What I'm doing wrong?
So the problem was in php.ini for CLI, which is located in /etc/php5/cli/, after I added extension=/usr/lib/php5/20100525/phalcon.so there, I was able to use Devtools. Thanks to #NikolaosDimopoulos
Official documentation is a bit confusing so try this:
I think this is a problem of extension not loaded
After successfully compile steps:
sudo apt-get install php5-dev php5-mysql gcc git-core
git clone git https://github.com/Phalcon/cphalcon.git
cphalcon cd/build
sudo ./install
Create a new file called "30-phalcon.ini"
and within it call the extension Phalcon with this single line:
extension=phalcon.so
save the file and copy the folder "/etc/php5/apache2/conf.d /" and "/etc/php5/cli/conf.d/"
restart the server: sudo service apache2 restart
While the devtools do this:
sudo git clone https://github.com/phalcon/phalcon-devtools /var/www/devtools
then create a symbolic link to run via terminal:
1: sudo ln -s /var/www/devtools/phalcon.php /usr/bin/phalcon
2: sudo chmod ugo+x /usr/bin/phalcon
3: type "phalcon" in the terminal and see if it's work.
it should work now: D
I always install the devtools from the PEAR channel
pear channel-discover pear.phalconphp.com
pear install phalcon/Devtools
You might get an error that the Devtools are not in stable mode but (as of the time of this writing) you can use this command:
pear install phalcon/Devtools-0.5.0
Source