Skip to content
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

Don't support on macOS M1 #665

Open
alaminsahed opened this issue Oct 30, 2021 · 4 comments
Open

Don't support on macOS M1 #665

alaminsahed opened this issue Oct 30, 2021 · 4 comments

Comments

@alaminsahed
Copy link

The hasura-backend-plus don't work on macOS M1.

I know hasura official image doesn't work But there is an alternative unofficial docker image that did the job.

Is there any way to work with hasura backend plus on macOS M1?

error:

Recreating 6ee745e9e83b_hasurabackend_graphql-engine_1 ... 
Recreating 6ee745e9e83b_hasurabackend_graphql-engine_1 ... error

ERROR: for 6ee745e9e83b_hasurabackend_graphql-engine_1  Cannot start service graphql-engine: driver failed programming external connectivity on endpoint hasurabackend_graphql-engine_1 (2c97486c28ecac3c520e752077bc3a299d5d307f7ed61bd501c4512cb175e2ff): Bind for 0.0.0.0:8080 failed: port is already allocated

ERROR: for graphql-engine  Cannot start service graphql-engine: driver failed programming external connectivity on endpoint hasurabackend_graphql-engine_1 (2c97486c28ecac3c520e752077bc3a299d5d307f7ed61bd501c4512cb175e2ff): Bind for 0.0.0.0:8080 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.

docker-compose.ymal file

version: "3.6"
services:
  postgres:
    image: "nhost/postgres:12-v0.0.6"
    restart: always
    volumes:
      - "./db_data:/var/lib/postgresql/data"
    environment:
      POSTGRES_PASSWORD: pgpassword
      POSTGRES_DB: postgres
  graphql-engine:
    image: fedormelexin/graphql-engine-arm64
    depends_on:
      - postgres
    restart: always
    ports:
      - "8080:8080"
    environment:
      HASURA_GRAPHQL_DATABASE_URL: >-
        postgres://postgres:pgpassword@postgres:5432/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
      HASURA_GRAPHQL_ADMIN_SECRET: hello123
      HASURA_GRAPHQL_JWT_SECRET: >-
        {"type":"HS256", "key":
        "jhyu89jiuhyg7678hoijhuytf7ghjiasodibagsdga9dha8os7df97a6sdgh9asudgo7f7g8h1uuoyafsod8pgasipdg8aps9dhaiaisydg8agsd87gasd9oihasd87gas78d"}
      HASURA_GRAPHQL_UNAUTHORIZED_ROLE: public
    command:
      - graphql-engine
      - serve
  hasura-backend-plus:
    image: "nhost/hasura-backend-plus:latest"
    container_name: hbp-dev-hbp
    depends_on:
      - graphql-engine
    restart: always
    ports:
      - "4000:4000"
    environment:
      HOST: 0.0.0.0
      PORT: 4000
      DATABASE_URL: >-
        postgres://postgres:pgpassword@postgres:5432/postgres
      SERVER_URL: "http://localhost:4000"
      HASURA_ENDPOINT: "http://graphql-engine:8080/v1/graphql"
      HASURA_GRAPHQL_ADMIN_SECRET: hello123
      JWT_KEY: >-
        jhyu89jiuhyg7678hoijhuytf7ghjiasodibagsdga9dha8os7df97a6sdgh9asudgo7f7g8h1uuoyafsod8pgasipdg8aps9dhai;sd
      JWT_ALGORITHM: HS256
      ALLOWED_REDIRECT_URLS: "http://localhost"
      JWT_CUSTOM_FIELDS: ""
      S3_ENDPOINT: "minio:9000"
      S3_SSL_ENABLED: "false"
      S3_BUCKET: nhost
      S3_ACCESS_KEY_ID: 5a7bdb5f42c41e0622bf61d6e08d5537
      S3_SECRET_ACCESS_KEY: 9e1c40c65a615a5b52f52aeeaf549944ec53acb1dff4a0bf01fb58e969f915c8
      AUTO_ACTIVATE_NEW_USERS: "true"
      PROVIDER_SUCCESS_REDIRECT: "http://localhost:3001/success"
      PROVIDER_FAILURE_REDIRECT: "http://localhost:3001/failed"
      HIBP_ENABLED: "false"
      DEFAULT_ALLOWED_USER_ROLES: "user,me"
      ALLOWED_USER_ROLES: "user,me"
      REGISTRATION_CUSTOM_FIELDS: "display_name"
      COOKIE_SECURE: "false"
      COOKIE_SECRET: "somelongvalue"
      REDIRECT_URL_SUCCESS: "http://localhost:3000"
      REDIRECT_URL_ERROR: "http://localhost:3000/fail"
  minio:
    image: "minio/minio:RELEASE.2020-06-18T02-23-35Z"
    container_name: hbp-dev-minio
    user: "999:1001"
    restart: always
    environment:
      MINIO_ACCESS_KEY: 5a7bdb5f42c41e0622bf61d6e08d5537
      MINIO_SECRET_KEY: 9e1c40c65a615a5b52f52aeeaf549944ec53acb1dff4a0bf01fb58e969f915c8
    entrypoint: sh
    command: -c 'mkdir -p /data/nhost && /usr/bin/minio server /data'
    ports:
      - "9000:9000"
    volumes:
      - "./minio_data:/data"
@elitan
Copy link
Contributor

elitan commented Oct 30, 2021

You docker-compose file looks good. Based on your error (Bind for 0.0.0.0:8080 failed: port is already allocated) it seems like you already have a service running on port 8080.

Try find it (netstat -vanp tcp | grep 8080) and kill it before starting your docker-compose file again.

@alaminsahed
Copy link
Author

@elitan thanks for the response. I followed your previous hints. Now there is no error on my console. But in docker, all docker images are restarting automatically. When I go to http://localhost:8080/console, there is nothing in databases. Maybe data migration failed there.

docker image:

Screen Shot 2021-10-31 at 1 03 05 PM

@eingress
Copy link

eingress commented Nov 3, 2021

@alaminsahed I've just built a couple of images that work on both x64 & arm64, you can find them on dockerhub

eingressio/hasura-backend-plus-app
eingressio/hasura-backend-plus-postgres

No readmes yet but nothing different thats worth mentioning really - had to fork HBP and bump the 'sharp' version in order to get prebuilt arm libmusl (alpine) libs for it.

Top tip, you can also update minio to minio/minio:latest to get an arm64 build so your stack is arm all the way.

Successfully deployed locally on M1 & remotely on x64

@brandiqa
Copy link

Another tip, try running using the docker-compose up without the -d so that you can see the log output in realtime

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

No branches or pull requests

4 participants