zodern / meteor-up

Production Quality Meteor Deployment to Anywhere
http://meteor-up.com/
MIT License
1.27k stars 280 forks source link

Deployment Fails when including fido2-lib #1337

Closed cormip closed 1 year ago

cormip commented 1 year ago

Problem: fido2-lib has a dependency on cbor-x who uses platform-dependent cbor-extract to install itself. In this case, to install on Ubuntu 22.04 x64 it's looking for Python to install itself and fails when it can't find it. Any help in solving this would be appreciated.

Mup version: 1.5.10

Mup config

{
  "servers": {
    "one": {
      "host": "1.2.3.4",
      "username": "root",
      "password": "password"
    }
  },
  "app": {
    "name": "my-app",
    "path": "../",
    "servers": {
      "one": {}
    },
    "buildOptions": {
      "serverOnly": true,
      "buildLocation": "../../my-app-build"
    },
    "env": {
      "ROOT_URL": "https://subdomain.host.com",
      "SESSION_TIMEOUT_SECONDS": 900,
      "MONGO_URL": "mongodb+srv://user:pass@subdomain.subdomain.host.com/mydb?retryWrites=true&w=majority&readPre
ference=primary",
      "MONGO_OPLOG_URL": "mongodb+srv://oplog_reader:XXXXXXXXXXXXX@xxxxx.xxxxxxxx.mongodb.net/local",
      "STRIPE_SECRET_KEY": "sk_test_XXXXXXXXXXXXXXXXXXXXXXX",
      "STRIPE_WEBHOOK_SECRET": "whsec_XXXXXXXXXXXXXXXXXXXXXXXX",
      "HTTP_FORWARDED_COUNT": 1,
      "MAIL_URL": "smtp://postmaster@example.com:xxxxxxxxxxxxxxxxxxxxx@smtp.xxxxxxxxxx.org:587",
      "EMAILABLE_KEY": "live_xxxxxxxxxxxxxxxx",
      "AWS_ACCESS_KEY": "XXXXXXXXXXXXXXX",
      "AWS_SECRET_ACCESS_KEY": "XXXXXXXXXXXXXXXXXXXXXXX",
      "AWS_S3_BUCKET_NAME": "dev.example.com",
      "AWS_REGION": "us-east-1",
      "MONTI_APP_ID": "XXXXXXXXXXX",
      "MONTI_APP_SECRET": "xxxxxxxxxxxxxxxxxxxxxxxx",
      "VIRTUAL_HOST": "subdomain.host.com",
      "HTTPS_METHOD": "redirect",
      "LETSENCRYPT_HOST": "subdomain.host.com",
      "LETSENCRYPT_EMAIL": "email@domain.com",
      "VIRTUAL_PORT": 3000
    },
      "docker": {
      "image": "zodern/meteor:root",
      "stopAppDuringPrepareBundle": true,
      "imagePort": 3000
    },
    "enableUploadProgressBar": true,
    "type": "meteor"
  },
  "proxy": {
    "servers": {
      "one": {}
    },
    "domains": "subdomain.host.com",
    "ssl": {
      "letsEncryptEmail": "email@domain.com",
      "forceSSL": true
    }
  }
}
✓ Config is valid

Output of command

Building App Bundle Locally

Started TaskList: Pushing Meteor App
[161.35.10.253] - Pushing Meteor App Bundle to the Server
[161.35.10.253] - Pushing Meteor App Bundle to the Server: SUCCESS

Started TaskList: Prepare App Bundle
[161.35.10.253] - Prepare Bundle
[161.35.10.253] x Prepare Bundle: FAILED

              ------------------------------------STDERR------------------------------------

              ------------------------------------STDOUT------------------------------------
               Python For more information consult the documentation at:
        gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
        gyp ERR! find Python **********************************************************
        gyp ERR! find Python
        gyp ERR! configure error
        gyp ERR! stack Error: Could not find any Python installation to use
        gyp ERR! stack     at PythonFinder.fail (/built_app/programs/server/node_modules/node-gyp/lib/find-python.js:315:47)
        gyp ERR! stack     at PythonFinder.runChecks (/built_app/programs/server/node_modules/node-gyp/lib/find-python.js:144:21)
        gyp ERR! stack     at PythonFinder.<anonymous> (/built_app/programs/server/node_modules/node-gyp/lib/find-python.js:251:16)
        gyp ERR! stack     at PythonFinder.execFileCallback (/built_app/programs/server/node_modules/node-gyp/lib/find-python.js:282:7)
        gyp ERR! stack     at ChildProcess.exithandler (child_process.js:374:7)
        gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
        gyp ERR! stack     at maybeClose (internal/child_process.js:1088:16)
        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
        gyp ERR! System Linux 5.15.0-56-generic
        gyp ERR! command "/home/app/.nvm/versions/node/v14.21.2/bin/node" "/built_app/programs/server/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
        gyp ERR! cwd /built_app/programs/server/npm/node_modules/cbor-extract
        gyp ERR! node -v v14.21.2
        gyp ERR! node-gyp -v v8.0.0
        gyp ERR! not ok
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! cbor-extract@2.1.1 install: `node-gyp-build-optional-packages`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the cbor-extract@2.1.1 install script.
        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

        npm ERR! A complete log of this run can be found in:
        npm ERR!     /root/.npm/_logs/2023-01-27T20_29_00_306Z-debug.log
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! meteor-dev-bundle@ install: `node npm-rebuild.js`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the meteor-dev-bundle@ install script.
        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

        npm ERR! A complete log of this run can be found in:
        npm ERR!     /root/.npm/_logs/2023-01-27T20_29_00_381Z-debug.log
        The command '/bin/sh -c cd /built_app/programs/server &&     npm install --unsafe-perm' returned a non-zero code: 1

        real    1m59.301s
        user    0m2.478s
        sys     0m4.500s

              ------------------------------------------------------------------------------
+-- fido2-lib@3.3.5
| ...
| +-- cbor-x@1.4.1
| | `-- cbor-extract@2.1.1
| |   +-- UNMET OPTIONAL DEPENDENCY @cbor-extract/cbor-extract-darwin-arm64@2.1.1
| |   +-- UNMET OPTIONAL DEPENDENCY @cbor-extract/cbor-extract-darwin-x64@2.1.1
| |   +-- UNMET OPTIONAL DEPENDENCY @cbor-extract/cbor-extract-linux-arm@2.1.1
| |   +-- UNMET OPTIONAL DEPENDENCY @cbor-extract/cbor-extract-linux-arm64@2.1.1
| |   +-- UNMET OPTIONAL DEPENDENCY @cbor-extract/cbor-extract-linux-x64@2.1.1
| |   +-- @cbor-extract/cbor-extract-win32-x64@2.1.1
| |   `-- node-gyp-build-optional-packages@5.0.3
| ...
cormip commented 1 year ago

SOLVED: As per MeteorUp docs Customize docker image, (yeah, RTFM...) I added buildInstructions:

docker: {
  image: 'zodern/meteor:root',
  buildInstructions: [
    'RUN apt-get update && apt-get install -y python3'
  ]
}