Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back the 2->3 upgrade docs #246

Open
wants to merge 5 commits into
base: 4.x
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
384 changes: 384 additions & 0 deletions docs/getting_started/how_to_update_mautic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,390 @@
php bin/console mautic:update:apply --finish


To Update Mautic from 2.x to 3.x
*********************************
If you are on mautic 2.x + then it is better for you to upgrade to 3.x and higher version in this section let's deep dive into upgrading mautic from 2.x to 3.x version.

Check failure on line 80 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'Mautic' instead of 'mautic'. Raw Output: {"message": "[Vale.Terms] Use 'Mautic' instead of 'mautic'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 80, "column": 15}}}, "severity": "ERROR"}

Check warning on line 80 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Mautic' instead of 'mautic'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Mautic' instead of 'mautic'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 80, "column": 15}}}, "severity": "INFO"}

Check warning on line 80 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Contractions] Feel free to use 'it's' instead of 'it is'. Raw Output: {"message": "[Google.Contractions] Feel free to use 'it's' instead of 'it is'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 80, "column": 33}}}, "severity": "INFO"}

Check warning on line 80 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'let's'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'let's'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 80, "column": 107}}}, "severity": "WARNING"}

Check failure on line 80 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'Mautic' instead of 'mautic'. Raw Output: {"message": "[Vale.Terms] Use 'Mautic' instead of 'mautic'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 80, "column": 138}}}, "severity": "ERROR"}

Check warning on line 80 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Mautic' instead of 'mautic'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Mautic' instead of 'mautic'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 80, "column": 138}}}, "severity": "INFO"}

Let's Get Started !

Check warning on line 82 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'Let's'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'Let's'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 82, "column": 1}}}, "severity": "WARNING"}

1. Step One : Fix the data migrations, in your current mautic repo path execute the below commands:

Check warning on line 84 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Colons] ': F' should be in lowercase. Raw Output: {"message": "[Google.Colons] ': F' should be in lowercase.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 84, "column": 13}}}, "severity": "WARNING"}

Check failure on line 84 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'Mautic' instead of 'mautic'. Raw Output: {"message": "[Vale.Terms] Use 'Mautic' instead of 'mautic'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 84, "column": 56}}}, "severity": "ERROR"}

Check warning on line 84 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Mautic' instead of 'mautic'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Mautic' instead of 'mautic'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 84, "column": 56}}}, "severity": "INFO"}

Check failure on line 84 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'repo'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'repo'?", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 84, "column": 63}}}, "severity": "ERROR"}

.. code-block:: shell

sudo php /var/www/html/mautic/app/console doctrine:migration:migrate

sudo php /var/www/html/mautic/app/console doctrine:schema:update --force

sudo -u www-data php /var/www/html/mautic/app/console cache:clear

The cache clear may take some to get executed.

After the Migration is done we can go ahead and update the Database !

Check warning on line 96 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('is done'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('is done').", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 96, "column": 21}}}, "severity": "INFO"}

Check warning on line 96 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'we'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'we'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 96, "column": 29}}}, "severity": "WARNING"}

2. Upgrade to 2.16.5 (If you haven't yet) :

Check warning on line 98 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 98, "column": 22}}}, "severity": "INFO"}

.. code-block:: shell

cd /var/www/html/mautic

sudo -u www-data php app/console mautic:update:find

sudo -u www-data php app/console mautic:update:apply


3. Upgrade the to php 7.3 version :

Check failure on line 109 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'PHP' instead of 'php'. Raw Output: {"message": "[Vale.Terms] Use 'PHP' instead of 'php'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 109, "column": 19}}}, "severity": "ERROR"}

.. code-block:: shell

sudo apt upgrade -y

sudo apt install software-properties-common -y

sudo add-apt-repository ppa:ondrej/php

sudo apt update -y

sudo apt install php7.3

sudo apt install php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip php7.3-intl -y

4. Edit Your php ini file :

Check failure on line 125 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'PHP' instead of 'php'. Raw Output: {"message": "[Vale.Terms] Use 'PHP' instead of 'php'.", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 125, "column": 14}}}, "severity": "ERROR"}

Check failure on line 125 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'ini'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'ini'?", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 125, "column": 18}}}, "severity": "ERROR"}

.. code-block:: shell

sudo nano /etc/php/7.3/apache2/php.ini

find the following attributes and change the values of the below variables as shown below.

short_open_tag = On

Check failure on line 133 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'short_open_tag'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'short_open_tag'?", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 133, "column": 1}}}, "severity": "ERROR"}
memory_limit = 256M

Check failure on line 134 in docs/getting_started/how_to_update_mautic.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'memory_limit'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'memory_limit'?", "location": {"path": "docs/getting_started/how_to_update_mautic.rst", "range": {"start": {"line": 134, "column": 1}}}, "severity": "ERROR"}
upload_max_filesize = 100M
max_execution_time = 300
post_max_size = 64M

5. Activate your php 7.3 Version and turn off 7.1 version :

.. code-block:: shell

sudo a2enmod php7.3

sudo a2dismod php7.1

sudo systemctl restart apache2

php -v


6. Update the Database

- Backup your Database :

.. code-block:: shell

mysqldump -u root -p --all-databases > all-db.sql

psw: ysSmK3t87wyC

- Remove the old mariaDB db :

.. code-block:: shell

sudo apt remove mariadb-server

- Adding a New apt source :

.. code-block:: shell

sudo apt install software-properties-common -y

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

sudo nano /etc/apt/sources.list.d/mariadb.list

- Add :

.. code-block:: shell

deb [arch=amd64,arm64,ppc64el]
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main


- Update and Install the New Version of mariaDB :

.. code-block:: shell

sudo apt update

sudo apt install mariadb-server -y

exit

- Remove the Non-compatible plugins :

.. code-block:: shell

cd /var/www/html/mautic/

sudo -u www-data php /var/www/html/mautic/app/console mautic:update:find

- Search for the Upgrade :

.. note::

This step really depends on your installed and non-M3 compatible plugins.

.. code-block:: shell

cd /var/www/html/mautic/plugins

rm -R GautitClearcacheBundle/
rm -R MauticAdvancedTemplatesBundle/
rm -R SmsreaderBundle/

Optionally in this step we could also just move them out from this folder :

.. code-block:: shell

mv /var/www/html/mautic/plugins/GautitClearcacheBundle /var/www/html
mv /var/www/html/mautic/plugins/MauticAdvancedTemplatesBundle /var/www/html
mv /var/www/html/mautic/plugins/MauticRecaptchaBundle /var/www/html
mv /var/www/html/mautic/plugins/SmsreaderBundle /var/www/html



7. Installing Mautic 3

To start can execute the below commands :

.. code-block:: shell

sudo -u www-data php upgrade_v3.php

If you installed via composer originally, you will need to use this trick :

.. code-block:: shell

mv composer.json composer.json2
sudo -u www-data php upgrade_v3.php

- If you get an error here just check if the ownership permissions are set properly

then run the upgrage again :

.. code-block:: shell

sudo -u www-data php upgrade_v3.php

8. Looking for new versions in 3.0 and then updating it 3.0+ :

.. code-block:: shell

sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:find
sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:apply
sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:apply --finish

- set ownership and clear the cache :

.. code-block:: shell

sudo chown -R www-data:www-data /var/www/html/mautic/
sudo chmod -R 755 /var/www/html/mautic/
sudo -u www-data php /var/www/html/mautic/bin/console cache:clear


9. Last Step:

Change your cron jobs from :

.. code-block:: shell

/app/console

to :

.. code-block:: shell

/bin/console

- If you would like to use the new Email Builder, go to plugins, click on install plugins and turn on the new builder.
You might need to log in and out before it's actvated.

There you go finally upgraded to mautic 3.0 !!!

If you are already on 3.x+ version and want to upgrade it to 4.x we got you covered check the below documentation.

To Update Mautic from 3.x to 4.x
*********************************
- Mautic 4 is the most stable release,It is already being used by many customers.When it was upgraded from Mautic 2 to Mautic 3,It had several issues with the database structure and even the file system.Here is a simple guide to go ahead !.

You need to be at the root folder which is the /var/www/html/ currently where the mautic code resides.

1. First step is to backup the file system , as said you need to be at /var/www/html/ for upgrading and for executing the commands given below:
the below command is used to backup your file system :

.. code-block:: shell

zip -r output_file.zip folder1

2. Backup your Database

.. code-block:: shell

mysqldump -u [user_name] -p [password] [mautic database_name] > [dumpfilename.sql]

you can then check if your files are created By running the below command :

.. code-block:: shell

ls -la

you should see the .sql and .zip files generated by running the above command.

3. Updating your current Environment
- Updating your php version from php7.3 to php7.4 and updating rest packages :

.. code-block:: shell

apt install mariadb-server apache2 libapache2-mod-php7.4 php7.4 unzip php7.4-xml php7.4-mysql php7.4-imap php7.4-zip php7.4-intl php7.4-curl php7.4-gd php7.4-mbstring php7.4-bcmath ntp -y

- Now lets change the Environment Variables :

.. code-block:: shell

sudo nano /etc/php/7.4/apache2/php.ini

after running this command one should change the following variables values accordingly :

.. code-block:: shell

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 300
post_max_size = 64M

.. note::

Regarding memory limit, you can be more generous and lift to 512M as well. Upload max filessize is also up to you. I suggest a minimum of 20MB.

4. Now move to php4 officially, and restart our Apache :

.. code-block:: shell

sudo a2enmod php7.4
sudo a2dismod php7.3
sudo systemctl restart apache2

and then check the current version of the php which is been used :

.. code-block:: shell

php -v

.. note::
If you get something like this :
.. code-block:: shell

PHP 7.4.23 (cli) (built: Aug 26 2021 15:51:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.23, Copyright (c), by Zend Technologies

then we need to stop the cron jobs running in the background

.. code-block:: shell

sudo crontab -e

one fix is that you can add a # in front of the cron commands, like:

.. code-block:: shell

# * * * * * CRONJOBS HERE

5. Command Line Update !
- In order to create more tension we will do this in 2 steps. First we update to 3.3.4 and then to 4.0.1.

Let's look for a new version:

.. code-block:: shell

cd /var/www/html/mautic
sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:find

after finding the latest version we need to apply it :

.. code-block:: shell

sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:apply

.. note::
Now we are prompted to apply finish. I would like to stop here for a moment. I know, that it is not the right way to use sudo when you are working here, but it is just simpler for folks if we don't go into permissions. But using a root user during updates can cause file creation with the wrong ownership. In order to avoid it we will make sure by almost every step that the files belong to the right user. So we hand over the files to the www-data user all the time (which is running our we server.)

- We do it by running this:

.. code-block:: shell

sudo chown -R www-data:www-data /var/www/html/mautic/
sudo chmod -R 755 /var/www/html/mautic/

- and now we can finish it by the following command :

.. code-block:: shell

sudo -u www-data php /var/www/html/mautic/bin/console
mautic:update:apply --finish

- If everything went well, we are on the 3.3.4 version, half way to 4.0.1. Let's look for a new version, and apply changes:

.. code-block:: shell

sudo -u www-data php /var/www/html/mautic/bin/console
mautic:update:find
sudo -u www-data php /var/www/html/mautic/bin/console
mautic:update:apply

.. note::
make sure that the file permissions is okay :

.. code-block:: shell

sudo chown -R www-data:www-data /var/www/html/mautic/

sudo chmod -R 755 /var/www/html/mautic/

And here comes the last step We are here ! Take a deep breath :

.. code-block:: shell

sudo -u www-data php /var/www/html/mautic/bin/console
mautic:update:apply --finish

Congrats you are on Mautic 4.x version give yourself a pat on your back !

.. note::

Need to make sure your templates are okay. Make sure,
that all of your email / landing page templates have the following config file
format especially the red line:

.. code-block:: shell

{
"name": "Template name",
"author": "Mautic team",
"authorUrl": "https://mautic.org",
"builder": ["grapesjsbuilder"],
"features": [
"email"
]
}
- If you are upgrading from a previous version, all your templates will have “builder”: “grapesjsbuilder”,
format, and you really need those brackets now.

Updating in the browser
***********************

Expand Down
Loading