ByteInternet / hypernode-docker

Fast and easy Docker for Magento development
https://community.hypernode.io/hypernode-docker
35 stars 8 forks source link

Make Magento 2 configuration the default (~/nginx/magento2.flag) #52

Open Aquive opened 2 years ago

Aquive commented 2 years ago

I catch myself regularly forgetting to set the magento2.flag. I'd like to suggest to make M2 the default config since M1 is deprecated a while. So default would be M2. And if someone needs M1 they can make magento1.flag :)

vdloo commented 2 years ago

we'll update that soon, touching the /data/web/nginx/magento2.flag flag by default sounds like a good idea. in the mean time you could write your own Dockerfile that uses the image and touches that file right?

edit: for reference, here's where the magento2.flag magic happens https://github.com/ByteInternet/nginx_config_reloader/blob/ee7b984507089fe0f67bb7a6d1e7f260a9a61d3f/nginx_config_reloader/__init__.py#L100

Aquive commented 2 years ago

I don't have experience editing or making custom docker files (yet). Just using the stock image :)

Do you have a guide for this on de Hypernode docs? If not, I'll just wait. It certainly isn't a showstopper.

vdloo commented 2 years ago

Here's a very basic example:

$ ls
Dockerfile
$ cat Dockerfile 
FROM docker.hypernode.com/byteinternet/hypernode-buster-docker:latest
RUN touch /data/web/nginx/magento2.flag
RUN /usr/bin/nginx_config_reloader
$ docker build -t myhypernodedocker .
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM docker.hypernode.com/byteinternet/hypernode-buster-docker:latest
 ---> cc798fc775a4
Step 2/3 : RUN touch /data/web/nginx/magento2.flag
 ---> Using cache
 ---> 547bfb5525c3
Step 3/3 : RUN /usr/bin/nginx_config_reloader
 ---> Running in bb0c984cbff4
2021-08-23 14:07:36,634 nginx_config_reloader INFO     /data/web/nginx
2021-08-23 14:07:36,714 nginx_config_reloader WARNING  Not reloading, nginx not running
Removing intermediate container bb0c984cbff4
 ---> 5eb1580c1275
Successfully built 5eb1580c1275
Successfully tagged myhypernodedocker:latest
$ docker run myhypernodedocker

now when you log in to the container with SSH you'll see your Dockerfile's changes reflected in the container:

root@4c0f86c798b4 /etc/nginx # ls -slthra | grep magento2
4.0K -rw-r--r-- 1 root root    3.4K Jul  3 14:22 magento2.conf
   0 lrwxrwxrwx 1 root root      24 Aug 23 14:07 magento.conf -> /etc/nginx/magento2.conf
root@4c0f86c798b4 /etc/nginx # ls /data/web/nginx/ | grep magento2
magento2.flag