t-chab / dockerfiles

Some useful dockerfiles
GNU General Public License v3.0
22 stars 25 forks source link

Can you create a version of amule docker for arm processors, like raspberry? #7

Closed alfamatteo92 closed 5 years ago

t-chab commented 5 years ago

Hi,

Can you be more specific ?

Amule should build fine on raspberry pi.

Did you try to build this image on a raspberry pi and had trouble with it ?

alfamatteo92 commented 5 years ago

This image is only for x86. I asked if it was possible to create same image but for arm processors.

Il mar 26 mar 2019, 18:13 Thomas Chabaud notifications@github.com ha scritto:

Hi,

Can you be more specific ?

Amule should build fine on raspberry pi.

Did you try to build this image on a raspberry pi and had trouble with it ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tchabaud/dockerfiles/issues/7#issuecomment-476753685, or mute the thread https://github.com/notifications/unsubscribe-auth/AVJwqfODMkBVcxP4UOFC3xQqRW4KH2mJks5valVHgaJpZM4cE2ZR .

alfamatteo92 commented 5 years ago

It gives exec format error, of course, because it's not built for arm processors

t-chab commented 5 years ago

Is it buildable if you replace the base image with an arm one (FROM arm32v7/alpine ) ?

alfamatteo92 commented 5 years ago

yes, it works!!! how can I modify web ui with this one https://github.com/MatteoRagni/AmuleWebUI-Reloaded ??? Default one sucks

t-chab commented 5 years ago

Thanks for the discovery, I didn't know this nice UI.

Can you try with the following files, it should do the trick :

Dockerfile

FROM arm32v7/alpine:latest
MAINTAINER docker@chabs.name

ENV AMULE_VERSION 2.3.2
ENV UPNP_VERSION 1.6.22
ENV CRYPTOPP_VERSION CRYPTOPP_5_6_5

RUN apk --update add gd geoip libpng libwebp pwgen sudo wxgtk2.8 zlib bash && \
    apk --update add --virtual build-dependencies alpine-sdk automake \
                               autoconf bison g++ gcc gd-dev geoip-dev \
                               gettext gettext-dev git libpng-dev libwebp-dev \
                               libtool libsm-dev make musl-dev wget \
                               wxgtk2.8-dev zlib-dev

# Build libupnp
RUN mkdir -p /opt \
    && cd /opt \
    && wget "http://downloads.sourceforge.net/sourceforge/pupnp/libupnp-${UPNP_VERSION}.tar.bz2" \
    && tar xvfj libupnp*.tar.bz2 \
    && cd libupnp* \
    && ./configure --prefix=/usr \
    && make \
    && make install

# Build crypto++
RUN mkdir -p /opt && cd /opt
    && git clone --branch ${CRYPTOPP_VERSION} --single-branch "https://github.com/weidai11/cryptopp" /opt/cryptopp
    && cd /opt/cryptopp
    && sed -i -e 's/^CXXFLAGS/#CXXFLAGS/' GNUmakefile
    && export CXXFLAGS="${CXXFLAGS} -DNDEBUG -fPIC"
    && make -f GNUmakefile \
    && make libcryptopp.so \
    && install -Dm644 libcryptopp.so* /usr/lib/ \
    && mkdir -p /usr/include/cryptopp \
    && install -m644 *.h /usr/include/cryptopp/

# Build amule from source
RUN mkdir -p /opt/amule \
    && git clone --branch ${AMULE_VERSION} --single-branch "https://github.com/amule-project/amule" /opt/amule \
    && cd /opt/amule \
    && ./autogen.sh \
    && ./configure \
        --disable-gui \
        --disable-amule-gui \
        --disable-wxcas \
        --disable-alc \
        --disable-plasmamule \
        --disable-kde-in-home \
        --prefix=/usr \
        --mandir=/usr/share/man \
        --enable-unicode \
        --without-subdirs \
        --without-expat \
        --enable-amule-daemon \
        --enable-amulecmd \
        --enable-webserver \
        --enable-cas \
        --enable-alcc \
        --enable-fileview \
        --enable-geoip \
        --enable-mmap \
        --enable-optimize \
        --enable-upnp \
        --disable-debug \
    && make \
    && make install

# Install a nicer web ui
RUN cd /usr/share/amule/webserver \
    && git clone https://github.com/MatteoRagni/AmuleWebUI-Reloaded \
    && rm -rf .git AmuleWebUI-Reloaded/doc-images

# Add startup script
ADD amule.sh /home/amule/amule.sh

# Final cleanup
RUN chmod a+x /home/amule/amule.sh \
    && rm -rf /var/cache/apk/* && rm -rf /opt \
    && apk del build-dependencies

EXPOSE 4711/tcp 4712/tcp 4672/udp 4665/udp 4662/tcp 4661/tcp

ENTRYPOINT ["/home/amule/amule.sh"]

amule.sh

#!/usr/bin/env bash

# Uncomment for debug
#set -x

AMULE_UID=${PUID:-5000}
AMULE_GID=${PGID:-5000}

AMULE_HOME=/home/amule/.aMule
AMULE_INCOMING=/incoming
AMULE_TEMP=/temp
AMULE_CONF=${AMULE_HOME}/amule.conf
REMOTE_CONF=${AMULE_HOME}/remote.conf

AMULE_GROUP="amule"
if grep -q ":${AMULE_GID}:" /etc/group; then
    echo "Group ${AMULE_GID} already exists. Won't be created."
    AMULE_GROUP=$(getent group "${AMULE_GID}" | cut -d: -f1)
    echo "Group ${AMULE_GROUP} with GID ${AMULE_GID} will be used as amule group."
else
    addgroup -g "${AMULE_GID}" amule
fi

if grep -q ":${AMULE_UID}:" /etc/passwd; then
    echo "User ${AMULE_UID} already exists. Won't be added."
else
    adduser -S -s /sbin/nologin -u "${AMULE_UID}" -h "/home/amule" -G "${AMULE_GROUP}" amule
fi

if [ ! -d "${AMULE_INCOMING}" ]; then
    echo "Directory ${AMULE_INCOMING} does not exists. Creating ..."
    mkdir -p ${AMULE_INCOMING}
    chown -R "${AMULE_UID}:${AMULE_GID}" "${AMULE_INCOMING}"
fi

if [ ! -d "${AMULE_TEMP}" ]; then
    echo "Directory ${AMULE_TEMP} does not exists. Creating ..."
    mkdir -p ${AMULE_TEMP}
    chown -R "${AMULE_UID}:${AMULE_GID}" "${AMULE_TEMP}"
fi

if [[ -z "${GUI_PWD}" ]]; then
    AMULE_GUI_PWD=$(pwgen -s 64)
    echo "No GUI password specified, using generated one: ${AMULE_GUI_PWD}"
else
    AMULE_GUI_PWD="${GUI_PWD}"
fi
AMULE_GUI_ENCODED_PWD=$(echo -n "${AMULE_GUI_PWD}" | md5sum | cut -d ' ' -f 1)

if [[ -z "${WEBUI_PWD}" ]]; then
    AMULE_WEBUI_PWD=$(pwgen -s 64)
    echo "No web UI password specified, using generated one: ${AMULE_WEBUI_PWD}"
else
    AMULE_WEBUI_PWD="${WEBUI_PWD}"
fi
AMULE_WEBUI_ENCODED_PWD=$(echo -n "${AMULE_WEBUI_PWD}" | md5sum | cut -d ' ' -f 1)

if [ ! -d ${AMULE_HOME} ]; then
    echo "${AMULE_HOME} directory NOT found. Creating directory ..."
    sudo -H -u '#'${AMULE_UID} sh -c "mkdir -p ${AMULE_HOME}"
fi

if [ ! -f ${AMULE_CONF} ]; then
    echo "${AMULE_CONF} file NOT found. Generating new default configuration ..."
    cat > ${AMULE_CONF} <<- EOM
[eMule]
AppVersion=2.3.1
Nick=http://www.aMule.org
QueueSizePref=50
MaxUpload=0
MaxDownload=0
SlotAllocation=2
Port=4662
UDPPort=4672
UDPEnable=1
Address=
Autoconnect=1
MaxSourcesPerFile=300
MaxConnections=500
MaxConnectionsPerFiveSeconds=20
RemoveDeadServer=1
DeadServerRetry=3
ServerKeepAliveTimeout=0
Reconnect=1
Scoresystem=1
Serverlist=0
AddServerListFromServer=0
AddServerListFromClient=0
SafeServerConnect=0
AutoConnectStaticOnly=0
UPnPEnabled=0
UPnPTCPPort=50000
SmartIdCheck=1
ConnectToKad=1
ConnectToED2K=1
TempDir=${AMULE_TEMP}
IncomingDir=${AMULE_INCOMING}
ICH=1
AICHTrust=0
CheckDiskspace=1
MinFreeDiskSpace=1
AddNewFilesPaused=0
PreviewPrio=0
ManualHighPrio=0
StartNextFile=0
StartNextFileSameCat=0
StartNextFileAlpha=0
FileBufferSizePref=16
DAPPref=1
UAPPref=1
AllocateFullFile=0
OSDirectory=${AMULE_HOME}
OnlineSignature=0
OnlineSignatureUpdate=5
EnableTrayIcon=0
MinToTray=0
ConfirmExit=1
StartupMinimized=0
3DDepth=10
ToolTipDelay=1
ShowOverhead=0
ShowInfoOnCatTabs=1
VerticalToolbar=0
GeoIPEnabled=1
ShowVersionOnTitle=0
VideoPlayer=
StatGraphsInterval=3
statsInterval=30
DownloadCapacity=300
UploadCapacity=100
StatsAverageMinutes=5
VariousStatisticsMaxValue=100
SeeShare=2
FilterLanIPs=1
ParanoidFiltering=1
IPFilterAutoLoad=1
IPFilterURL=
FilterLevel=127
IPFilterSystem=0
FilterMessages=1
FilterAllMessages=0
MessagesFromFriendsOnly=0
MessageFromValidSourcesOnly=1
FilterWordMessages=0
MessageFilter=
ShowMessagesInLog=1
FilterComments=0
CommentFilter=
ShareHiddenFiles=0
AutoSortDownloads=0
NewVersionCheck=0
AdvancedSpamFilter=1
MessageUseCaptchas=1
Language=
SplitterbarPosition=75
YourHostname=
DateTimeFormat=%A, %x, %X
AllcatType=0
ShowAllNotCats=0
SmartIdState=0
DropSlowSources=0
KadNodesUrl=http://upd.emule-security.org/nodes.dat
Ed2kServersUrl=http://gruk.org/server.met.gz
ShowRatesOnTitle=0
GeoLiteCountryUpdateUrl=http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
StatsServerName=Shorty's ED2K stats
StatsServerURL=http://ed2k.shortypower.dyndns.org/?hash=
[Browser]
OpenPageInTab=1
CustomBrowserString=
[Proxy]
ProxyEnableProxy=0
ProxyType=0
ProxyName=
ProxyPort=1080
ProxyEnablePassword=0
ProxyUser=
ProxyPassword=
[ExternalConnect]
UseSrcSeeds=0
AcceptExternalConnections=1
ECAddress=
ECPort=4712
ECPassword=${AMULE_GUI_ENCODED_PWD}
UPnPECEnabled=0
ShowProgressBar=1
ShowPercent=1
UseSecIdent=1
IpFilterClients=1
IpFilterServers=1
TransmitOnlyUploadingClients=0
[WebServer]
Enabled=1
Password=${AMULE_WEBUI_ENCODED_PWD}
PasswordLow=
Port=4711
WebUPnPTCPPort=50001
UPnPWebServerEnabled=0
UseGzip=1
UseLowRightsUser=0
PageRefreshTime=120
Template=AmuleWebUI-Reloaded
Path=amuleweb
[GUI]
HideOnClose=0
[Razor_Preferences]
FastED2KLinksHandler=1
[SkinGUIOptions]
Skin=
[Statistics]
MaxClientVersions=0
[Obfuscation]
IsClientCryptLayerSupported=1
IsCryptLayerRequested=1
IsClientCryptLayerRequired=0
CryptoPaddingLenght=254
CryptoKadUDPKey=338883508
[PowerManagement]
PreventSleepWhileDownloading=0
[UserEvents]
[UserEvents/DownloadCompleted]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/NewChatSession]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/OutOfDiskSpace]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/ErrorOnCompletion]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[HTTPDownload]
URL_1=
EOM
    echo "${AMULE_CONF} successfullly generated."
else
    echo "${AMULE_CONF} file found. Using existing configuration."
fi

if [ ! -f ${REMOTE_CONF} ]; then
    echo "${REMOTE_CONF} file NOT found. Generating new default configuration ..."
    cat > ${REMOTE_CONF} <<- EOM
Locale=
[EC]
Host=localhost
Port=4712
Password=${AMULE_GUI_ENCODED_PWD}
[Webserver]
Port=4711
UPnPWebServerEnabled=0
UPnPTCPPort=50001
Template=AmuleWebUI-Reloaded
UseGzip=1
AllowGuest=0
AdminPassword=${AMULE_WEBUI_ENCODED_PWD}
GuestPassword=
EOM
    echo "${REMOTE_CONF} successfullly generated."
else
    echo "${REMOTE_CONF} file found. Using existing configuration."
fi

chown -R "${AMULE_UID}:${AMULE_GID}" /home/amule
sudo -H -u '#'${AMULE_UID} sh -c "amuled -c ${AMULE_HOME} -o"
synopsis8 commented 5 years ago

Many thanks for this great support. Your code is well documented also. I was able to fork is and create a Raspberry version specific for LibreELEC and OpenELEC (different paths). I've been using different ports as TCP port 4662 is often restricted by many ISP's. I've added a ipfilter.dat as well

t-chab commented 5 years ago

Thanks for the feedback.

I've added a link to your fork if some people are interested in using ARM image.

I've also added an option to use a nicer web UI theme with 75b92a3f23b918f2c0f25764f18aee462b0f3eeb

I'll also try to add an ipfilter.dat when I'll have some time.

synopsis8 commented 5 years ago

merci, c'est très sympa de ta part.

J'avais aussi implementé la nouvelle GUI puisque tu donnais des conseils à ce propos. Concernant le ipfilter.datJe présume qu'il est bon, puisque mis à jour régulièrement. Cependant, je trouve parfois sur le net des IPs qui n'y sont pas. On Monday, 8 April 2019, 19:34:04 CEST, Thomas Chabaud notifications@github.com wrote:

Thanks for the feedback.

I've added a link to your fork if some people are interested in using ARM image.

I've also added an option to use a nicer web UI theme with 75b92a3

I'll also try to add an ipfilter.dat when I'll have some time.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.