Magento code setup
mkdir -p ~/Sitescd $_git clone https://github.com/mamei-tech/kuberaxpress_config.git kuberaxpress-prodNote: if dev environment run: git clone --branch dev https://github.com/mamei-tech/kuberaxpress_dockerconfigs.git kuberaxpress-dev
cd $_docker compose -f compose.yaml up phpfpm -dNote: if dev environment run:
docker compose -f compose.dev.yaml -f compose.yaml up phpfpm -d
git clone https://github.com/mamei-tech/kuberaxpress_magento.git srcNote: if dev environment run: git clone --branch dev https://github.com/mamei-tech/kuberaxpress_magento.git src
Start some containers, copy files to them and then restart the containers:
bin/start --no-devNote: if dev environment run:
bin/start
Initial copy will take a few minutes...
bin/copytocontainer --allbin/composer installbin/setup-composer-authunzip ./backup/kubera.main.sql.zipYou can use the bin/mysql script to import a database:
bin/mysql < ./backup/kubera.main.sqlNote: Update database connection details to use the above Docker MySQL credentials: Also note: creds for the MySQL server are defined at startup from env/db.env vi src/app/etc/env.php
Import app-specific environment settings:
bin/magento app:config:importNote: if you want to use a custom branch, run the following command:
bin/cli git checkout 2.4-developNote: If you do not have at least 6GB RAM configured for docker, you must manually run the bin/setup script steps.
If you have at least 6 GB of RAM configured for Docker, run:
bin/setup kuberaxpress.comNote: if dev environment run:
bin/setup dev.kuberaxpress.com
open https://you_domain_name
uncomment line three in ./images/Dockerfile
git pull
docker-compose build
bin/restartTo learn more you can visit the following link: Magento 2 Modes.
You need to run the following command:
bin/magento deploy:mode:showYou can enable production mode by running the below command:
bin/magento deploy:mode:set productionYou need to run the command below:
bin/magento deploy:mode:set developerbin/magento module:statusInstall the Magento2-Module-DisableTwofactorah module:
bin/composer require markshust/magento2-module-disabletwofactorauth
bin/magento module:enable MarkShust_DisableTwoFactorAuth
bin/magento setup:upgradeDisable 2FA in production mode:
bin/magento config:set twofactorauth/general/enable 0Note: desactivar el de production solo hasta configurar el email sender smtp, luego volver a activar. En developer mode si puedes dejarlo desactivado.
To disable 2FA in developer mode run:
bin/magento config:set twofactorauth/general/disable_in_developer_mode 0In case anyone needs a temporary workaround to get this working without having SMTP set up:
- navigate to /admin and log in
- you should see the 2FA screen now
- add
var_dump($url);die;on line 86 invendor/magento/module-two-factor-auth/Model/EmailUserNotifier.php - refresh /admin
- copy the URL that is displayed
- remove the var_dump
- use the URL copied earlier to navigate to the 2FA setup
bin/composer require mageplaza/module-smtp
bin/magento setup:upgrade
bin/magento setup:static-content:deploy -fActivate the module once within the administration with the following data:
register_name: kubera
register_email: admin@kuberaxpress.com
-
Disable smtp auth in your organization in the EAC
- To disable SMTP AUTH globally in your organization in the EAC, go to the
Settings > Mail Flowsettings page and toggle the setting labeled Turn off SMTP AUTH protocol for your organization. - Follow the steps of this doc: https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission#disable-smtp-auth-in-your-organization
- To disable SMTP AUTH globally in your organization in the EAC, go to the
-
In Magento admin
-
Go to the menu "Stores> Settings - Configuration > General - Store Email Adressess" and modify all sender email by
admin@kuberaxpress.comand thenSave Config -
Go to the menu "Stores> Settings - Configuration" in the left lateral menu Go to the "Advanced > System" section and configure the "Mail Sending Settings" section similar to the steps above.
-
Go to the menu "Stores> SMTP - Configuration > SMTP Configuration Options" and load the Office386 default configuration in
Load Settingsbutton, then changes protocol to TLS and select LOGIN Authentication and add User and password from Email Office386. Then Send test email.
-
Then you can activate the 2FA for the Developer Mode and try it to see if you get the configuration mail.
- https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/multi-sites/ms-admin.html?lang=en
- https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/multi-sites/ms-nginx.html?lang=en
To run the Certbot container, execute the below script in your host machine:
./scripts/setup-ssl-certbot kuberaxpress.comCertificates will only be valid for 90 days so we need to automate the renewal. We setup our Cron job with:
crontab -eWe add the following line:
0 3 * * mon /home/express/Sites/kuberaexpress/scripts/renew-ssl-certbot
This will execute the renew-ssl-certbot script every Monday at 3am.
Generate a new certificate valid for the following names (ex: kuberaxpress.com dev.kuberaxpress.com)
bin/setup-ssl kuberaxpress.com dev.kuberaxpress.combin/magento cache:disablebin/magento cache:flushRun the following command to clean the config and full_page caches:
bin/magento cache:clean config full_pagebin/magento indexer:reindex && bin/magento cache:clean && bin/magento cache:flush
bin/mysqldump > ./backup/backup_filename.sqlUse the bin/mysql script to import a database:
bin/mysql < ./backup/kubera.main.sqlzip -9 -r -q ./backup/backup_filename.sql.zip ./backup/backup_filename.sqlunzip ./backup/backup_filename.sql.zipbin/magento setup:static-content:deploy --theme Magento/backend es_ESNote: if dev environment run:
bin/magento setup:static-content:deploy -f --theme Magento/backend es_ES
bin/magento module:disable a_module_namebin/magento module:statusbin/composer remove module_namebin/magento module:uninstall module_namebin/magento setup:static-content:deploy -fbin/magento setup:di:compileIf you use version 2.4.6-p3 or Magento higher you must install this module to be able to send SMTP emails:
bin/composer require laminas/laminas-zendframework-bridge:1.8.0