DEV Community

Cover image for Python script to automate the installation of several cms in Devilbox
Eritech
Eritech

Posted on

Python script to automate the installation of several cms in Devilbox

I won't explain in detail as the repo is simple to use but I will just write the structure of the repo, and you are welcome to try and give your suggestions or contributions.

Installation script
-
Installation steps

  • clone this repository: https://github.com/bashebr/cms-installation-script.git
  • create virtualenv: virtualenv venv --python=3.6( or any python3 version)
  • Follow the instruction to install python3 in devilbox written in the wiki
  • Your devilbox directory name should be devilbox

The instruction script has the following directories

  • Applicaitons
  • Config
  • Core

Finally, the script that runs the application

  • install_script.py

Applications

This directory consists of all applications that need to be installed, such as

  • Drupal
  • Magento
  • plugins
  • Prestashop
  • WordPress

Each of the above directories contains a python script that installs the application.

Config

The config directory consists of the following config files

  • general_config.py

    • Method: grep_container returns both mysql_container && php_container
  • versions.py

    • This file contains versions that need to be installed
    • Here in this file you can see, the version you want to install
    • Only set the version of the Application you want to install

Core
--

The core directory has the following files

  • db.py: This file creates the database

Some Extra config

Some installations may complain about the PHP memory unit limit, so we should set to all containers default as unlimited by the following.

  • Goto devilbox/cfg/php-ini-phpversion(eg 4.5)
  • then create a new file, that with ini extension, as devilbox-php.ini, then paste the following code
  • Then you need to restart your container once
  • code is

--

; Memory
; Note: "memory_limit" should be larger than "post_max_size"
memory_limit            = -1
Enter fullscreen mode Exit fullscreen mode

Changes to script on how to install python3 in devilbox

Copy and paste( actually replace it with) the following script to the former script in devilbox, //python3.sh//


#!/usr/bin/env bash

root="/shared/httpd"

cd ${root}

apt-get update
apt-get install -y python3
apt-get install -y python3-pip
apt-get install python3-distutils

PYTHON3="/usr/bin/python3"
PIP3="/usr/bin/pip3"
if [ ! -L ${PYTHON3} ] && [ ! -L ${PIP3}]; then
  ln -s /usr/bin/python3 ${PYTHON3}
  ln -s /usr/bin/pip3 ${PIP3}
fi

Enter fullscreen mode Exit fullscreen mode

NOTE REGARDING Magento 2.4.2 FATAL ERROR

During Magento 2.4.2 installation the following fatal error occurred. According to the GitHub link

https://github.com/jbboehr/php-psr/issues/78#issuecomment-722290110

Then, I create the following workaround:

In your .env file inside the devilbox, search for PHP_MODULES_DISABLE and add psr to the list and save and restart docker.
so, finally, it will be:

Note
The phalcon module is also added because it depends on psr

PHP_MODULES_DISABLE=oci8,PDO_OCI,pdo_sqlsrv,sqlsrv,rdkafka,swoole,psr,phalcon

Top comments (0)