nginx-amplify-agent icon indicating copy to clipboard operation
nginx-amplify-agent copied to clipboard

UUID Renews with Every Build of docker-compose, How can we set Permenant UUID and Prevent Generated new Instances on Amplify Website??

Open insiyatif opened this issue 2 years ago • 3 comments

Hi, I'm using Nginx via docker-compose with this configuration;

  nginx:
    image: nginx
    container_name: nginx
    hostname: RNginx
    ports:
      - "80:80"
      - "443:443"
    restart: always

# command: bash -c /etc/nginx/afy_custom_amplify_install.sh #"apt-get update && apt-cache pkgnames | grep python3 && apt-get install git wget gcc python3 gnupg2 nano -y && curl -L -O https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh && API_KEY='THE_API_KEY' sh ./install.sh -y"

    volumes:
      - ./nginx/conf/:/etc/nginx/conf.d/:ro
      - ./certs/:/etc/nginx/certs/:ro    
      - ./nginx/log/:/var/log/nginx/:rw  
      - ./nginx/nginx/nginx.conf:/etc/nginx/nginx.conf:ro  
#      - ./nginx/amplify-agent/:/etc/amplify-agent/:rw
#      - ./nginx/nginx/afy_manual_amplify_install.sh:/etc/nginx/afy_manual_amplify_install.sh:ro
environment:
  - TZ=Europe/Istanbul
  - DEBIAN_FRONTEND=noninteractive

  webapi:
     ....
  web:
     ....
  mongo:
     ....
  etc...

I'm publishing my web/api etc.. projects almost everyday. But whenever I re build docker-compose, Nginx is also builds, and with everybuilds, the uuid regenerated. Amplify.Nginx.com shows new monitoring screen via uuid changes. My history gets interrupts by new instances.

I have tried using volumes for amplify-agent conf file before installing, the install.sh file, but I couldn't get succeded with many errors whatever I tried.

I want the amplify could be installed inside Nginx container first, then keep the uuid wheter the nginx builds again or not.

Thanks for your helps..

insiyatif avatar Apr 09 '23 03:04 insiyatif

@insiyatif consider using imagename configuration option (see https://github.com/nginxinc/docker-nginx-amplify#13-aggregate-mode for details)

defanator avatar Apr 10 '23 15:04 defanator

@defanator thanks for your answer. I have already tried that, but after you said, I run docker run --name mynginx1 -e API_KEY='THE_API_KEY' -e AMPLIFY_IMAGENAME=my-service-123 -d nginx-amplify script again with my key. But I got the error below:

[root@vmi740842 dockerTest]# docker run --name nginx -e API_KEY='THE_API_KEY' -e AMPLIFY_IMAGENAME=my-service-123 -d nginx-amplify
Unable to find image 'nginx-amplify:latest' locally
Trying to pull repository docker.io/library/nginx-amplify ... 
/usr/bin/docker-current: repository docker.io/nginx-amplify not found: does not exist or no pull access.
See '/usr/bin/docker-current run --help'.

nginx-amplify is not found. Actually, the main problem was this for me. I couldn't find this image, so I was running the nginx first, and then installing the amplify. But in that situation I couldn't have the previous uuid.

And normally I'm using docker-compose to build my apps, if it's possible for nginx and amplify too, it would be better.

What can I do now?

insiyatif avatar Apr 12 '23 08:04 insiyatif

@insiyatif you will need to either build your own image, or use any of prebuilt ones from https://hub.docker.com/r/nginxinc/amplify-agent/tags

defanator avatar Apr 12 '23 13:04 defanator