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

update on docker #18

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

devopsoptimbytes
Copy link

@devopsoptimbytes devopsoptimbytes commented Oct 9, 2023

docker-compose file and the scripts details in readme

Closes #14

Copy link
Collaborator

@muyncky muyncky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I get

 ! elasticsearch The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s 
 ✔ Container magento-magento-1                                                                                                                                  Started0.6s 
 ! magento The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested       0.0s 

Copy link
Collaborator

@muyncky muyncky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I get

image with reference docker.io/bitnami/magento:2 was found but does not match the specified platform: wanted linux/arm64/v8, actual: linux/amd64

Can you have a look at this?

@devopsoptimbytes
Copy link
Author

which OS you're using to deploy the service

@muyncky
Copy link
Collaborator

muyncky commented Oct 10, 2023

which OS you're using to deploy the service

macOS.

@devopsoptimbytes
Copy link
Author

can we do a short call as I'm also using a macos and the error was of image compatibility we can check on call

@muyncky
Copy link
Collaborator

muyncky commented Oct 10, 2023

can we do a short call as I'm also using a macos and the error was of image compatibility we can check on call

Yes, I sent you a dm.

@muyncky
Copy link
Collaborator

muyncky commented Oct 11, 2023

@invohamza @devopsoptimbytes any updates? Any thing you need from me?

@devopsoptimbytes
Copy link
Author

As i did some r&d on the arm64 apple m1 chipset there is no official image made for that by magento will share you the reference there is no issue on the compose file for that you can test it on any windows, ubuntu and macos with intel chipset. If you specifically wanted a image for arm64 then it need to be developed specifically for arm64

https://magento.stackexchange.com/questions/364840/magento-cloud-docker-build-arm64-images-for-existing-project
magento/magento-cloud-docker#326

@muyncky
Copy link
Collaborator

muyncky commented Oct 12, 2023

As i did some r&d on the arm64 apple m1 chipset there is no official image made for that by magento will share you the reference there is no issue on the compose file for that you can test it on any windows, ubuntu and macos with intel chipset. If you specifically wanted a image for arm64 then it need to be developed specifically for arm64

https://magento.stackexchange.com/questions/364840/magento-cloud-docker-build-arm64-images-for-existing-project magento/magento-cloud-docker#326

Some ideas/suggestions:

  • Isn't that the point of Docker? That it runs on all machines...
  • Are there unofficial images / ways.
  • What makes this incompatible with m1 chips? Is there something we can run ourselves with a Dockerfile to circumvent this issue?
  • We've been working on Add docker compose for development #15, that one is working and installing everything, but the Magento installation is extremely slow. Maybe you have recommendations for this PR?

@devopsoptimbytes
Copy link
Author

the error we are getting is not on OS it's on the chipset
there is a way we will get code from magento repository and create our own image to support our chipset
I have shared the related issues but will do some more reserch
will check which image is used in this regard

@devopsoptimbytes
Copy link
Author

please change the image instead of docker.io/bitnami/magento:2 ( official image )
to alexcheng/magento2 for magento and run it this is the image previously used also looking for other images that can go with arm64

@muyncky
Copy link
Collaborator

muyncky commented Oct 12, 2023

please change the image instead of docker.io/bitnami/magento:2 ( official image ) to alexcheng/magento2 for magento and run it this is the image previously used also looking for other images that can go with arm64

Can you commit this and request me for review? Thanks!

@devopsoptimbytes
Copy link
Author

changed on the code please check but this is not the official image which can cause issue on the production and is not a good approach to use

Magento 2 does not provide an official image specifically optimized for Apple's M1 chipset with the ARM64 architecture.

@devopsoptimbytes
Copy link
Author

if that won't work you can check this as this is the created by some devs for specific m1 chipset

https://github.com/luancschmitz/docker-magento-mac-m1/tree/master/compose

Copy link
Collaborator

@muyncky muyncky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not working, see my inline comments.

cd /bitnami/magento/

# Use composer to install the Dropday extension
composer require dropday/magento2-extension
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you mount it as a volume to this current repo, because the purpose is to develop on the extension with Docker as develop environment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve this issue.

readme Outdated
@@ -0,0 +1,32 @@
Setting Up Your Magento Environment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the README.md and make it in the same style. Place it at the bottom, under the title "Test and Developing with Docker"

readme Outdated
Comment on lines 17 to 20
Before you proceed, ensure that you modify the container name in the script to match the actual name of your Magento container. Once done, execute the password setup
script:

sh password.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you automate this process.

Read #14 again. It's all about reproducibility of this extension. Too many manual steps will cause human error.

readme Outdated

docker-compose up -d

Verifying Container Names:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the container names?

m(16:59:32) Magento $ docker ps
CONTAINER ID   IMAGE                     COMMAND                  CREATED          STATUS          PORTS                                                 NAMES
3a753d1fb033   alexcheng/magento2        "/sbin/my_init"          15 minutes ago   Up 15 minutes   80/tcp, 0.0.0.0:80->8080/tcp, 0.0.0.0:443->8443/tcp   magento-magento-1
a8233be62425   bitnami/elasticsearch:7   "/opt/bitnami/script…"   15 minutes ago   Up 15 minutes   9200/tcp, 9300/tcp                                    magento-elasticsearch-1
8f3938b9699c   bitnami/mariadb:10.6      "/opt/bitnami/script…"   15 minutes ago   Up 15 minutes   3306/tcp                                              magento-mariadb-1

readme Outdated
Before you proceed, ensure that you modify the container name in the script to match the actual name of your Magento container. Once done, execute the password setup
script:

sh password.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m(16:59:26) Magento $ sh password.sh
Creating admin user...
bash: line 2: magento: command not found
Failed to create the admin user.
Script execution completed.

readme Outdated

You can access the Magento admin dashboard by navigating to:

localhost/admin
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not reachable at all.

@muyncky
Copy link
Collaborator

muyncky commented Oct 12, 2023

changed on the code please check but this is not the official image which can cause issue on the production and is not a good approach to use

Magento 2 does not provide an official image specifically optimized for Apple's M1 chipset with the ARM64 architecture.

There is no "production"; this containerization project is only about testing & developing on the extension.

if that won't work you can check this as this is the created by some devs for specific m1 chipset

https://github.com/luancschmitz/docker-magento-mac-m1/tree/master/compose

This does not install much, as far as I can see. Do whatever you need to solve this.

@devopsoptimbytes
Copy link
Author

The scripts didn't run because the image we use now was not running the magento. that's what i said the image was not official let me check with other images or the way we can run this on m1 chipset

@muyncky
Copy link
Collaborator

muyncky commented Oct 13, 2023

@devopsoptimbytes in PR #15 you will see a working process. Run make install.

The issue, however, is that it is super slow.

@devopsoptimbytes
Copy link
Author

I have found a solution which will help but you have to run the commands manually for them just create a directory and run the curl command i will share it will clone and execute the scripts create every container and service you just need to give credentials of repo.magento.com which i will provide you and after setup need to run single command to setup dashboard credentials and you are good to go if that's suites you let me know i will share the readme with all the credentials and steps

Copy link
Collaborator

@muyncky muyncky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devopsoptimbytes

Thanks for the hard work an thorough investigation on the subject. I also appreciate that you are thinking out the box.

But I have some feedback

  • Your deliverables are very hard to test. You are providing a service that is supposed to automate a process. What you deliver are text written instruction on how to manually achieve something. Considering that we are working on programming solutions and using Docker, it is a good practice to write a Makefile, bash script or other tools that automate a process. You don't want me to test something, and then having it fail because I make errors in the steps that I manually copy from your text instructions.
  • Your comments, especially your last comment, is really hard to read, since the length of the sentence is really long. I don't really understand what you are saying.
  • I mentioned earlier to add a README.md. What I see instead is more text files with no markup, it is very hard to read and understand, since there is not structure.

Please check my inline comments on your PR review. Process this feedback.

Once you are done, request me for review by hitting the sync button, like so:
image

Help

I'm here to help, please let me know if anything is unclear. I will answer.

@devopsoptimbytes
Copy link
Author

@muyncky the requirement was to develop a compose file which was done the steps was mentioned in the file is automated will update that on readme please follow those steps and it will fetch makefiles images and compose files to deploy everything on your system there is nothing you are doing is manuall as just thee credentials you are putting will update the readme and follow the steps hope it will work otherwise will create another compose file but deploying on only m1 chipset will make it difficult for you to deploy the same stuff on anyother stuff as m1 chipset if you do some research on m1 chipset support issues it will clear alot of things

@devopsoptimbytes
Copy link
Author

please check the readme.md and follow the steps and it will setup if this not work will create a special image for your m1 chipset only

Copy link
Collaborator

@muyncky muyncky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@muyncky the requirement was to develop a compose file

The requirement is to solve #14. My recommendation would be to read that carefully.

which was done the steps was mentioned in the file is automated

Steps are manual, and not working.

will update that on readme

You replaced the readme.

please follow those steps

Did that, not working.

and it will fetch makefiles images and compose files to deploy everything on your system there is nothing you are doing is manuall as just thee credentials you are putting will update the readme and follow the steps

These are literally manual steps. That is not what I am asking for.

hope it will work otherwise will create another compose file but deploying on only m1 chipset will make it difficult for you to deploy the same stuff on anyother stuff as m1 chipset if you do some research on m1 chipset support issues it will clear alot of things

I don't see how the M1 chip is the problem anylonger. I see other images working slow but fine with M1

README.md Outdated
Comment on lines 1 to 34
Magento Extension for Dropday
===============
This is a Magento extension that enables Dropday functionality for your Magento store.

Dropday.io is a service to automate your webshop orders. With Dropday.io you can forward orders automatically to your suppliers via different methods, for example by placing a XML file on FTP, sending an email or letting a Dropday employee place a manual order on another webshop. This solution is ideal for dropshipping, fulfillment or other types or supplier automation.
Installation
Create a directory named sites on your system:

This extension will connect to the API and forward your orders to Dropday.io. To connect to the API make an account at [Dropday.io](https://dropday.io/register).
sudo mkdir sites

## How to install the extension?
Navigate to the sites directory:

### 1. Installion via Composer
cd sites

```
composer require dropday-io/module-orderautomation
```
Run the following command to execute the installation scripts and set up Docker:

### 2. Enable
curl -s https://raw.githubusercontent.com/devopsoptimbytes/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.6-p2 community

```
php bin/magento module:enable Dropday_OrderAutomation
php bin/magento setup:upgrade
php bin/magento cache:clean
```
During the process, you will be prompted for credentials for repo.magento.com:

### 3. Configure
Username: 217ab4e2c17a820d861e3f917785e066
Password: 0497283a6f53ed3c3358752151ff2bfc

Stores → Configuration → Dropday → Order Automation

- General Settings
- Enabled - Enable Order Automation
- Test Mode - Enable Test mode
- Account ID - Account ID from Dropday Dashboard
- API Key - Secret Key be provided by Dropday Dashboard
After the installation is complete, create the credentials for the Magento admin dashboard using the following command:


bin/magento admin:user:create --admin-user='username' --admin-password='password123' --admin-email='user@example.com' --admin-firstname='FirstName' --admin-lastname='LastName'


Once the admin user is created, disable the following modules using the following command:

bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth


This will disable the Magento_AdminAdobeImsTwoFactorAuth and Magento_TwoFactorAuth modules.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just replaced all other information about this open source project, why?

Put it back and make subsection, with installation instructions. See me previous review..

cd /bitnami/magento/

# Use composer to install the Dropday extension
composer require dropday/magento2-extension
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve this issue.

README.md Outdated
php bin/magento setup:upgrade
php bin/magento cache:clean
```
During the process, you will be prompted for credentials for repo.magento.com:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not working, see response:

sites $ curl -s https://raw.githubusercontent.com/devopsoptimbytes/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.6-p2 community
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in ***/Magento/sites/.git/
There must be at least 6GB of RAM allocated to Docker to continue.
service "phpfpm" is not running container #1
service "phpfpm" is not running container #1
Composer auth has been set up.
Fixing filesystem ownerships...
service "phpfpm" is not running container #1
Filesystem ownerships fixed.
service "phpfpm" is not running container #1
service "phpfpm" is not running container #1

README.md Outdated
- Test Mode - Enable Test mode
- Account ID - Account ID from Dropday Dashboard
- API Key - Secret Key be provided by Dropday Dashboard
After the installation is complete, create the credentials for the Magento admin dashboard using the following command:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No manual steps.

@devopsoptimbytes
Copy link
Author

ok I will automate it via docker compose with other images but the issue you are facing is not due to image it's due to ram allocation error state your docker engine doesn't even have 6gb of ram please increase them until then i will work on docker compose to get a light image

Copy link
Collaborator

@muyncky muyncky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README, gives a much clearer picture, thanks!

I commented platform: linux/arm64/v8 in order to start everything.

Most things seem to start, but I get this error at the end:

magento-magento-1        | magento 07:37:37.70 INFO  ==> Flushing cache
magento-magento-1        | magento 07:37:40.98 INFO  ==> Setting PHP expose_php option
magento-magento-1        | magento 07:37:41.05 INFO  ==> Setting PHP output_buffering option
magento-magento-1        | magento 07:37:41.29 INFO  ==> Setting PHP expose_php option
magento-magento-1        | magento 07:37:41.36 INFO  ==> Setting PHP output_buffering option
magento-magento-1        | magento 07:37:41.51 INFO  ==> Persisting Magento installation
magento-magento-1        | magento 07:38:05.66 INFO  ==> ** Magento setup finished! **
magento-magento-1        | 
magento-magento-1        | 
magento-magento-1        | magento 07:38:05.79 INFO  ==> ** Starting cron **
magento-magento-1        | magento 07:38:05.93 INFO  ==> ** Starting Apache **
magento-magento-1        | [Mon Oct 16 07:38:06.133067 2023] [core:emerg] [pid 1] (95)Operation not supported: AH00023: Couldn't create the mpm-accept mutex 
magento-magento-1        | (95)Operation not supported: could not create accept mutex
magento-magento-1        | AH00015: Unable to open logs
magento-magento-1 exited with code 1

#!/bin/bash

# Name of the Magento container
CONTAINER_NAME="magento-magento-1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target assumes the project is cloned in a directory called "magento". This project should be able to live in any directory name.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the directory name. This is the name of the container which is set prior and will remain same everythime any one setup the code

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the name of the container is determine by the folder that is lives in.

So magento-magento-1 is based on {directory}-{service}-{instance}.

I know this for a fact, because I ran the script from insude dropday-io-magento. And the name became dropday-io-magento-magento-1.

cd /bitnami/magento/

# Use composer to install the Dropday extension
composer require dropday-io/module-orderautomation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing this extension with compose makes a copy of the master/main branch of this extension. While we want this Docker project to enable developers to work on their current branch.
Therefor, the code should be mounted through the volumes. See code of this #15.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bash script created to install extension in the magento container because we need to install magento first in the container that was done on installing php apache magento and running all services there through a single image which is taken from public repo docker hub of bitnami. We can achieve this installation by creating docker file other then script but it will also doing the installtion through the script. The container have attached volume this extension will be stored in the volume this is the one time script running

Comment on lines +23 to +25
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the extension code base is mounted, I believe it will be installed automatically on installation.

#!/bin/bash

# Name of the Magento container
CONTAINER_NAME="magento-magento-1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also assumes that the project lives inside a folder called magento.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also not the directory name. This is the name of the container which is set prior and will remain same everytime any one setup the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Containerize with Docker
3 participants