smebberson / docker-alpine

Docker containers running Alpine Linux and s6 for process management. Solid, reliable containers.
MIT License
596 stars 187 forks source link

alpine-consul-nginx does not build #57

Closed matthewvalimaki closed 7 years ago

matthewvalimaki commented 8 years ago
 ---> Running in 00612f21dd21
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  nginx-1.10.1-r1:
    breaks: world[nginx=1.8.1-r0]

Problem seems to be with mixture of 3.4 and 3.2. The old repository should be dropped and main should be used instead I think.

A side note and a question: Nginx has stream_module that needs to be built-in for it to be supported. Reason why this matters is if you use Nginx for routing (i.e. database TCP connection from dc1 to dc2). I have custom image where I use Nginx from aports to build it in. Would there be interest to change alpine-nginx and alpine-consul-nginx to this custom build to support Nginx stream?

smebberson commented 8 years ago

I've just resolved this. I kept it as v1.8.1 but I'll start releasing some upgrades to catch up to the most current Nginx version.

Could you tell me port about this aports thingo, and how it would impact this image? I did stumble across the stream_module the other day and it piqued my interest so I'm keen to here your thoughts on this.

matthewvalimaki commented 8 years ago

Well nothing special in it. I create a user to build nginx under as abuild does not allow build as root, then I clone aports, modify the makefile so that includes the stream module in and then I simply execute abuild which creates packages installable with apk and then do cleanup. It behaves exactly like a build from repo. I'll send the dockerfile over tomorrow.

On Jul 21, 2016 7:24 PM, "Scott Mebberson" notifications@github.com wrote:

I've just resolved this. I kept it as v1.8.1 but I'll start releasing some upgrades to catch up to the most current Nginx version.

Could you tell me port about this aports thingo, and how it would impact this image? I did stumble across the stream_module the other day and it piqued my interest so I'm keen to here your thoughts on this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/smebberson/docker-alpine/issues/57#issuecomment-234438392, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_GtSPLJ7gDW55Njgwy3q9ZnY9Q6V66ks5qYCncgaJpZM4JMqH1 .

matthewvalimaki commented 8 years ago

Here's how I compile nginx with stream_module from aports master:

# Add files
ADD root /

RUN apk upgrade --update && \
    apk add openssl ca-certificates git openssh alpine-sdk linux-headers zlib-dev openssl-dev luajit-dev pcre-dev perl-dev paxmark && \

    addgroup build && \
    adduser -D -G build -s /bin/sh build && \
    addgroup build abuild && \
    echo "build ALL=(ALL) ALL" >> /etc/sudoers && \
    mkdir -p /var/cache/distfiles && \
    chmod a+w /var/cache/distfiles && \      

    su build -c "cd /tmp && \
        git clone https://github.com/alpinelinux/aports.git && \
        abuild-keygen -a -i -n -q && \
        cd /tmp/aports/main/nginx && \
        sed -i 's/--with-mail_ssl_module/--with-mail_ssl_module --with-stream/g' APKBUILD && \
        abuild unpack && \
        abuild prepare && \
        abuild -r" && \

    apk add --allow-untrusted /home/build/packages/main/x86_64/nginx-common-1.10.1-r2.apk && \
    apk add --allow-untrusted /home/build/packages/main/x86_64/nginx-1.10.1-r2.apk && \

    rm -rf /tmp/* && \
    rm -rf /home/build/* && \
    rm -rf /var/cache/distfile && \

    # cleanup
    apk del alpine-sdk linux-headers zlib-dev openssl-dev luajit-dev pcre-dev perl-dev paxmark openssh git && \
    rm -rf /var/cache/apk/* && \

    chown -R root:s6 /etc/ssl && \
    chmod -R g+w /etc/ssl && \

# For `s6-svc -h` to work properly we want to set proper group permissions
# see: https://github.com/just-containers/s6-overlay/issues/130#issuecomment-181956795
# Also fix permissions
    mkdir -p /etc/services.d/nginx/supervise/ && \
    mkfifo /etc/services.d/nginx/supervise/control && \
    chown -R root:s6 /etc/services.d/nginx && \
    chmod g+w /etc/services.d/nginx/supervise/control /etc/services.d/nginx && \

    chown -R root:s6 /etc/ssl && \
    chmod -R g+w /etc/ssl
matthewvalimaki commented 7 years ago

@smebberson with nginx 1.9.11 there's a new concept of dynamic modules. So with that this custom building of stream is no longer necessary. In Alpine Linux edge we already have the stream module available, check it out https://pkgs.alpinelinux.org/package/edge/main/x86_64/nginx and package nginx-mod-stream.

Closing this ticket as the original issue was resolved.