crowdsecurity / example-docker-compose

Example integration of crowdsec in docker-compose
114 stars 25 forks source link

no arm64 crowdsec docker image but only amd64 #4

Closed erdoukki closed 1 year ago

erdoukki commented 3 years ago

https://discourse.crowdsec.net/t/crowdsec-docker-amd64-only/313

erdoukki commented 3 years ago

I will look into this ASAP !

erdoukki commented 3 years ago

https://github.com/crowdsecurity/crowdsec/issues/1014

root@STARGATE:~/CS/example-docker-compose# docker image ls
REPOSITORY                 TAG           IMAGE ID       CREATED             SIZE
crowdsecurity/crowdsec     v1.2.0        2a8f750164f3   4 weeks ago         158MB

STEP 1 : OK STEP 2 : KO

Step 2/2 : RUN mkdir /data/ && wget https://crowdsec-statics-assets.s3-eu-west-1.amazonaws.com/metabase_sqlite.zip && unzip metabase_sqlite.zip -d /data/
 ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in 1a80e95d8c35
standard_init_linux.go:228: exec user process caused: exec format error
The command '/bin/sh -c mkdir /data/ && wget https://crowdsec-statics-assets.s3-eu-west-1.amazonaws.com/metabase_sqlite.zip && unzip metabase_sqlite.zip -d /data/' returned a non-zero code: 1
ERROR: Service 'dashboard' failed to build
erdoukki commented 3 years ago

The problem is from metabase image (amd64 only) ... will look at this !

erdoukki commented 3 years ago

From: https://github.com/metabase/metabase/issues/13119#issuecomment-925126957

-> example-docker-compose/crowdsec/dashboard/Dockerfile

##FROM metabase/metabase

FROM adoptopenjdk/openjdk11:debianslim-jre

ENV FC_LANG en-US LC_CTYPE en_US.UTF-8

# dependencies
RUN apt-get update -yq && apt-get install -yq bash ttf-dejavu fontconfig curl openjdk-11-jre-headless wget unzip && \
    apt-get clean && \
    rm -rf /var/lib/{apt,dpkg,cache,log}/ && \
    mkdir -p /app/certs && \
    curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem -o /app/certs/rds-combined-ca-bundle.pem  && \
    /opt/java/openjdk/bin/keytool -noprompt -import -trustcacerts -alias aws-rds -file /app/certs/rds-combined-ca-bundle.pem -keystore /etc/ssl/certs/java/cacerts -keypass changeit -storepass changeit && \
    curl https://cacerts.digicert.com/DigiCertGlobalRootG2.crt.pem -o /app/certs/DigiCertGlobalRootG2.crt.pem  && \
    /opt/java/openjdk/bin/keytool -noprompt -import -trustcacerts -alias azure-cert -file /app/certs/DigiCertGlobalRootG2.crt.pem -keystore /etc/ssl/certs/java/cacerts -keypass changeit -storepass changeit && \
    mkdir -p /plugins && chmod a+rwx /plugins && \
    useradd --shell /bin/bash metabase

RUN mkdir /data/ && wget https://crowdsec-statics-assets.s3-eu-west-1.amazonaws.com/metabase_sqlite.zip && unzip metabase_sqlite.zip -d /data/

USER metabase
WORKDIR /app

# copy app from the offical image
COPY --from=metabase/metabase:latest /app /app

# expose our default runtime port
EXPOSE 3000

# run it
ENTRYPOINT ["/app/run_metabase.sh"]
erdoukki commented 3 years ago

http://[host]:3000 ! works

erdoukki commented 3 years ago

All OK now, except that metabase crash on file not found errors !

dashboard_1      | 2021-10-21 12:15:33,512 INFO db.setup :: Verifying h2 Database Connection ...
dashboard_1      | org.h2.message.DbException: Log file error: "/data/metabase.db.trace.db", cause: "java.io.FileNotFoundException: /data/metabase.db.trace.db (Permission denied)" [90034-197]
dashboard_1      | org.h2.message.DbException: Log file error: "/data/metabase.db.trace.db", cause: "java.io.FileNotFoundException: /data/metabase.db.trace.db (Permission denied)" [90034-197]
...
dashboard_1      | Caused by: org.h2.jdbc.JdbcSQLException: Log file error: "/data/metabase.db.trace.db", cause: "java.io.FileNotFoundException: /data/metabase.db.trace.db (Permission denied)" [90034-197]
...
dashboard_1      | Caused by: java.io.FileNotFoundException: /data/metabase.db.trace.db (Permission denied)
...
dashboard_1      | 2021-10-21 12:16:17,379 ERROR metabase.core :: Metabase Initialization FAILED
alexceee commented 1 year ago

Same here, is there a fix for the above crash on file not found errors?

mmetc commented 1 year ago

Hi @alexceee ,

I can't replicate. How did you run it? It's even better if you can provide details on a separate issue because this has nothing to do with arm64 now

ApolloF commented 1 year ago

I made this Metabase arm64/amd64 image with the crowdsec dashboard integrated if anyone wants it.

tokar86a commented 1 year ago

I made this Metabase arm64/amd64 image with the crowdsec dashboard integrated if anyone wants it.

I try to run it but it dont seems to be able to run the database.

ApolloF commented 1 year ago

I made this Metabase arm64/amd64 image with the crowdsec dashboard integrated if anyone wants it.

I try to run it but it dont seems to be able to run the database.

Which tag are you using?

LaurenceJJones commented 1 year ago

Closing issue since metabase doesnt directly support arm64, so user has to rely on non official images