Skip to content

Home-made ARM support not working? #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
roomcays opened this issue Nov 27, 2020 · 7 comments
Open

Home-made ARM support not working? #11

roomcays opened this issue Nov 27, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@roomcays
Copy link

Hi there.
Based on the included dockerfile I have built XBrowserSync image on my RaspberryPi 3. It seemed to build properly.
However now when I try to run it behind the Nginx proxy (so not using Traefik) I keep getting:

502 Bad Gateway

and Nginx logs an error:

Nov 27 11:47:40 rpi3 nginx[258330]: 2020/11/27 11:47:40 [error] 258330#258330: *268 recv() failed (104: Unknown error) while reading response header from upstream, client: 192.168.1.1, server: xbsapi.domain.ltd, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:8082/", host: "xbsapi.domain.ltd"

I use docker-compose.yml as follows:

version: "3.7"

volumes:
  xbs-db-data:
    external: true

services:
  db:
    image: "mongo:4.2.6"
    container_name: "xbs-db"
    environment:
      - "MONGO_INITDB_DATABASE=xbrowsersync"
      - "MONGO_INITDB_ROOT_PASSWORD=$XBS_DB_PASSWORD"
      - "MONGO_INITDB_ROOT_USERNAME=$XBS_DB_USERNAME"
    restart: "always"
    volumes:
      - "xbs-db-data:/data/db"
      - "./mongoconfig.js:/docker-entrypoint-initdb.d/mongoconfig.js"

  api:
    image: e6d3618beb73 # "local/xbrowsersync"
    container_name: "xbs-api"
    depends_on:
      - "db"
    environment:
      - "XBROWSERSYNC_DB_PWD=$XBS_DB_PASSWORD"
      - "XBROWSERSYNC_DB_USER=$XBS_DB_USERNAME"
    ports:
      - "8082:8080"
    restart: "always"
    volumes:
      - "./settings.json:/usr/src/api/config/settings.json"

The e6d3618beb73 image hash is the reference to locally-built image for xbrowsersync/api, but built on ARM architecture.

Because I use Nginx on that "machine" natively (i.e. not with Docker) I have removed all Treafik stuff and redirected port 8080 from container to 8082 on host.
Containers (mongodb and xbrowsersync/api) start properly, they don't restart.

When trying to connect to the container bypassing the nginx, i.e. from within the host, I get "Connection reset by peer" error:

$ curl -vvv http://localhost:8082
*   Trying ::1:8082...
* Connected to localhost (::1) port 8082 (#0)
> GET / HTTP/1.1
> Host: localhost:8082
> User-Agent: curl/7.73.0
> Accept: */*
> 
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

However absolutely nothing is getting written to container logs, like there have been no requests at all. The last thing that gets logged is:

xbs-api | Provisioner finished.

I keep wondering where might be the cause of that unavailability. I doubt it is Nginx. Might it be the reason that image is not available for ARM officaly at hub.docker.com?

Is there anyone there who can help me? I'd love to self-host that solution on my low-energy RPI3 at home... :)

@nero120
Copy link
Member

nero120 commented Nov 27, 2020

Hi @roomcays, I also run an RP3 at home (running Nextcloud) so would be keen to get XBS running on it but didn't have the time to try yet so am interested in this.

Unfortunately I have very little spare time at the moment, I'm desperately trying to finish and deploy the next app release (v1.6.0) so the little spare time I have is going there. Once that's out, my next to-do item is to update the API so can look into this then, but I have no estimate for when that will be currently, sorry.

@nero120 nero120 added the enhancement New feature or request label Nov 27, 2020
@roomcays
Copy link
Author

@nero120 I am willing to help if you'd need my assistance. I code in PHP, but I do Docker a lot for daily work (development environments setup). So I can test new releases :)

@elbosso
Copy link

elbosso commented Mar 28, 2021

Hi, i have added a Dockerfile and a docker-compose.yml file for reference - although please note: I do not run this on a raspi but I use a rockpi instead, which means: arm64.

With the files provided, it runs smoothly with Traefik 2.x:

FROM arm64v8/node

# Set environment variables
ENV XBROWSERSYNC_API_VERSION 1.1.12

WORKDIR /usr/src/api

# Download release and unpack
RUN wget -q -O release.tar.gz https://github.com/xBrowserSync/api/archive/v$XBROWSERSYNC_API_VERSION.tar.gz \
        && tar -C . -xzf release.tar.gz \
        && rm release.tar.gz \
        && mv api-$XBROWSERSYNC_API_VERSION/* . \
        && rm -rf api-$XBROWSERSYNC_API_VERSION/

# Install dependencies
RUN npm install --only=production

# Expose port and start api
EXPOSE 8080
CMD [ "node", "dist/api.js"]
version: '3.3'

services:
  xbs-db:
    container_name: "xbs-db"
    environment:
      - "MONGO_INITDB_DATABASE=xbrowsersync"
      - "MONGO_INITDB_ROOT_PASSWORD=changeme"
      - "MONGO_INITDB_ROOT_USERNAME=xbs-root"
    image: "mongo:4.2.6"
    restart: "unless-stopped"
    volumes:
      - "./xbs-db-data:/data/db"
      - "./mongoconfig.js:/docker-entrypoint-initdb.d/mongoconfig.js"
    networks:
      - default
  xbs-api:
    build:
      context: ./ # Local
      dockerfile: Dockerfile_arm64
    container_name: "xbs-api"
    depends_on:
      - "xbs-db"
    environment:
      - "XBROWSERSYNC_DB_PWD=chanheme"
      - "XBROWSERSYNC_DB_USER=xbs-root"
#    image: "xbrowsersync/api:1.1.12"
#    ports:
#      - "8080:8080"
    restart: "unless-stopped"
    volumes:
      - "./settings.json:/usr/src/api/config/settings.json"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.xbrowsersync.rule=Host(`xbrowsersync.pi-docker.lab`)"
      - "traefik.http.services.xbrowsersync.loadbalancer.server.port=8080"
      - "traefik.docker.network=traefik_proxy"
    networks:
      - traefik_proxy
      - default

networks:
  traefik_proxy:
    external:
      name: pi_traefik_proxy
  default:
    driver:
      bridge

@wararjey
Copy link

I would like to get a xbrowsersync server working on an Oracle OCI A.1 instance. Those run arm64 cpus...

Regards,

@elbosso
Copy link

elbosso commented Mar 25, 2022

you can try my setup (directly above your comment) - this runs on arm64 since a few months without problems

@ioogithub
Copy link

@roomcays did you every find a solution this and get xbs working on arm64? I believe mongo works with this architecture. Did you compile your own arm copy locally?

elbosso I tried you solution by adding that dockerfile but without success, it did rebuild the image but I get the same docker error: exec /usr/local/bin/docker-entrypoint.sh: exec format error I have seen this error before and it usually indicates trying to start an image complied for the wrong platform. Did you also compile a local copy of the code on your arm platform or does the dockerfile do that?

nero120 its been a few years, is there any arm support for this project on arm?

@ioogithub
Copy link

@elbosso: I tried your solution again. Here is what I get

Building xbs_api
Sending build context to Docker daemon   29.7kB
Step 1/7 : FROM arm64v8/node
latest: Pulling from arm64v8/node
42cbebf8bc11: Pull complete
9a0518ec5756: Pull complete
356172c718ac: Pull complete
dddcd3ceb998: Pull complete
abe47058ac42: Pull complete
dca71e3720c5: Pull complete
c404b11f7696: Pull complete
3b7727825857: Pull complete
Digest: sha256:7b99c0e75c1499dd9c2a0ed14ebc022e134ba33deaccfba369dc00dfe91c1aed
Status: Downloaded newer image for arm64v8/node:latest
 ---> 77b11024a71b
Step 2/7 : ENV XBROWSERSYNC_API_VERSION 1.1.13
 ---> Running in a75b83c24d0d
Removing intermediate container a75b83c24d0d
 ---> 8244a4c18ee6
Step 3/7 : WORKDIR /usr/src/api
 ---> Running in fa0828e6f530
Removing intermediate container fa0828e6f530
 ---> 0d6e41d458e5
Step 4/7 : RUN wget -q -O release.tar.gz https://github.com/xBrowserSync/api/archive/v$XBROWSERSYNC_API_VERSION.tar.gz         && tar -C . -xzf release.tar.gz         && rm release.tar.gz         && mv api-$XBROWSERSYNC_API_VERSION/* .         && rm -rf api-$XBROWSERSYNC_API_VERSION/
 ---> Running in 98c3cf56dd88
Removing intermediate container 98c3cf56dd88
 ---> 4558111d9c30

Step 5/7 : RUN npm install --only=production
 ---> Running in 0379d5c06eed
npm WARN config only Use `--omit=dev` to omit dev dependencies from the install.
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile


added 125 packages, and audited 126 packages in 1m

3 packages are looking for funding
  run `npm fund` for details

10 vulnerabilities (2 moderate, 7 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 9.7.2 -> 9.8.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.8.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice
Removing intermediate container 0379d5c06eed
 ---> 22d96cff27a0
Step 6/7 : EXPOSE 1080
 ---> Running in c0e51cce1eec
Removing intermediate container c0e51cce1eec
 ---> 0b717f8fabe5
Step 7/7 : CMD [ "node", "dist/api.js"]
 ---> Running in d6974873aa33
Removing intermediate container d6974873aa33
 ---> cca04aadacfb
Successfully built cca04aadacfb
Successfully tagged docker-compose_xbs_api:latest
WARNING: Image for service xbs_api was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
xbs_db is up-to-date
Recreating xbs_api ... done
Attaching to xbs_api
xbs_api         | Failed to initialise log file.

After this it just exits. "Failed to initialise log file."

I feel like I am almost there but perhaps some of those npm errors during the build are what is causing the build to fail? Any suggestions on what I might try next?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants