zodern / meteor-up

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

Verifying Deployment: FAILED / Command failed: git rev-parse HEAD fatal: Not a git repository #1047

Closed salazarpardo closed 5 years ago

salazarpardo commented 5 years ago

Hi, I am trying to deploy a meteor app based on Vulcan.js, haven't been able to get past the Verifying Deployment step as it throws a git related error, but I am not sure where should I init or install git, or how can I fix it. Please help! Thanks in advance :)

Mup version (1.4.5):

Mup config

{
  "servers": {
    "one": {
      "host": "1.2.3.4",
      "username": "root",
      "pem": "~/.ssh/pem"
    }
  },
  "app": {
    "name": "my-app",
    "path": "../",
    "servers": {
      "one": {}
    },
    "buildOptions": {
      "serverOnly": true
    },
    "env": {
      "ROOT_URL": "https://host.com",
      "MONGO_URL": "mongodb://mongodb:27017/my-app",
      "MONGO_OPLOG_URL": "mongodb://mongodb/local",
      "VIRTUAL_HOST": "my-app.com,www.my-app.com",
      "HTTPS_METHOD": "redirect",
      "HTTP_FORWARDED_COUNT": 1,
      "LETSENCRYPT_HOST": "my-app.com,www.my-app.com",
      "LETSENCRYPT_EMAIL": "me@my-app.com"
    },
    "docker": {
      "image": "abernix/meteord:node-8.11.2-base",
      "stopAppDuringPrepareBundle": true,
      "args": [
        "--link=mongodb:mongodb"
      ]
    },
    "enableUploadProgressBar": true,
    "type": "meteor"
  },
  "mongo": {
    "version": "3.4.1",
    "servers": {
      "one": {}
    }
  },
  "proxy": {
    "domains": "my-app.com,www.my-app.com",
    "ssl": {
      "forceSSL": true,
      "letsEncryptEmail": "jc@my-app.com"
    }
  }
}

Output of command

Building App Bundle Locally

Started TaskList: Pushing Meteor App
[1.2.3.4] - Pushing Meteor App Bundle to the Server
[1.2.3.4] - Pushing Meteor App Bundle to the Server: SUCCESS
[1.2.3.4] - Prepare Bundle
node-8.11.2-base: Pulling from abernix/meteord
5dfbbcdbbb10: Already exists
a3ed95caeb02: Already exists
a3ed95caeb02: Already exists
4d4ee6f756a2: Already exists
a3ed95caeb02: Already exists
a3ed95caeb02: Already exists
a3ed95caeb02: Already exists
57f5e65087c6: Already exists
de4c8cd95f13: Already exists
34ff09f37fe5: Already exists
7cb4acd52089: Already exists
a3ed95caeb02: Already exists
493542de6e4e: Already exists
a3ed95caeb02: Already exists
Digest: sha256:c249becef99af39e9ac045259eb7d3ffa51cdfb9304874d5bc23a5eaff11af7e
Status: Image is up to date for abernix/meteord:node-8.11.2-base
Finished Extracting
Creating Dockerfile
Finished creating Dockerfile
Building image
Sending build context to Docker daemon  277.9MB
Step 1/12 : FROM abernix/meteord:node-8.11.2-base
# Executing 1 build trigger
 ---> Using cache
 ---> 61f97c14982a
Step 2/12 : RUN mkdir /built_app || true
 ---> Using cache
 ---> dde93258fab6
Step 3/12 : ENV ROOT_URL=https://my-app.com
 ---> Using cache
 ---> 1f755b41d89a
Step 4/12 : ENV MONGO_URL=mongodb://mongodb:27017/my-app
 ---> Using cache
 ---> 673c7e2f36bc
Step 5/12 : ENV MONGO_OPLOG_URL=mongodb://mongodb/local
 ---> Using cache
 ---> ac8807663090
Step 6/12 : ENV VIRTUAL_HOST=my-app.com,www.my-app.com
 ---> Using cache
 ---> fe13ac65fc8c
Step 7/12 : ENV HTTPS_METHOD=redirect
 ---> Using cache
 ---> 66c82e3923a3
Step 8/12 : ENV HTTP_FORWARDED_COUNT=1
 ---> Using cache
 ---> 26631cece946
Step 9/12 : ENV LETSENCRYPT_HOST=my-app.com,www.my-app.com
 ---> Using cache
 ---> 545d642886ed
Step 10/12 : ENV LETSENCRYPT_EMAIL=jc@my-app.com
 ---> Using cache
 ---> be63bbae4902
Step 11/12 : COPY ./ /built_app
 ---> Using cache
 ---> c14b4a1bf03f
Step 12/12 : RUN cd  /built_app/programs/server &&     npm install --unsafe-perm
 ---> Using cache
 ---> f9d9425ee2ae
Successfully built f9d9425ee2ae
Successfully tagged mup-my-app:build
Total reclaimed space: 0B
[1.2.3.4] - Prepare Bundle: SUCCESS

Started TaskList: Configuring App
[1.2.3.4] - Pushing the Startup Script
[1.2.3.4] - Pushing the Startup Script: SUCCESS
[1.2.3.4] - Sending Environment Variables
[1.2.3.4] - Sending Environment Variables: SUCCESS

Started TaskList: Start Meteor
[1.2.3.4] - Start Meteor
using image
removing last
Image mup-my-app:latest
Volume
Removing docker containers. Errors about nonexistent endpoints and containers are normal.
my-app
Error response from daemon: endpoint my-app not found
Error: No such container: my-app-frontend
Error response from daemon: endpoint my-app-frontend not found
Error: No such container: my-app-nginx-letsencrypt
Error response from daemon: endpoint my-app-nginx-letsencrypt not found
Error: No such container: my-app-nginx-proxy
Error response from daemon: endpoint my-app-nginx-proxy not found
Finished removing docker containers
481bce1d76b7c18fe2c915e4902c44deb1b36ec47899618526d14f7a539edfb7
Ran abernix/meteord:node-8.11.2-base
[1.2.3.4] - Start Meteor: SUCCESS
[1.2.3.4] - Verifying Deployment
Container has no IP Address, likely from the app crashing.
Container has no IP Address, likely from the app crashing.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 172.17.0.5 port 80: Connection refused
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 172.17.0.5 port 80: Connection refused
Container has no IP Address, likely from the app crashing.
Container has no IP Address, likely from the app crashing.
Container has no IP Address, likely from the app crashing.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 172.17.0.5 port 80: Connection refused
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 172.17.0.5 port 80: Connection refused
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 172.17.0.5 port 80: Connection refused
Container has no IP Address, likely from the app crashing.
Container has no IP Address, likely from the app crashing.
Container has no IP Address, likely from the app crashing.
Container has no IP Address, likely from the app crashing.
Container has no IP Address, likely from the app crashing.
=> Container status:
Container spent too much time restarting.
restarted: 7 times {"Bridge":"","SandboxID":"8e5201f41d21ba1ba46d1c5b59f5bedf3b32f8ed895d2925b78566aceaa324c9","HairpinMode":false,"LinkLocalIPv6Address":"","LinkLocalIPv6PrefixLen":0,"Ports":{},"SandboxKey":"/var/run/docker/netns/8e5201f41d21","SecondaryIPAddresses":null,"SecondaryIPv6Addresses":null,"EndpointID":"","Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","MacAddress":"","Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"2f362d40f970fc65542626cdc33be53d7fca464a1173aca1e7cb1bde9e856cac","EndpointID":"","Gateway":"","IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"","DriverOpts":null}}} {"Status":"restarting","Running":true,"Paused":false,"Restarting":true,"OOMKilled":false,"Dead":false,"Pid":0,"ExitCode":1,"Error":"","StartedAt":"2018-12-14T12:26:05.726805139Z","FinishedAt":"2018-12-14T12:26:08.702969595Z"}
=> Logs:
    at /built_app/programs/server/packages/vulcan_lib.js:6777:3
    at /built_app/programs/server/boot.js:411:36
    at Array.forEach (<anonymous>)
    at /built_app/programs/server/boot.js:220:19
    at /built_app/programs/server/boot.js:471:5
    at Function.run (/built_app/programs/server/profile.js:510:12)
    at /built_app/programs/server/boot.js:470:11
=> Starting meteor app on port:80
fatal: Not a git repository (or any of the parent directories): .git
/built_app/programs/server/node_modules/fibers/future.js:280
                        throw(ex);
                        ^

Error: Command failed: git rev-parse HEAD
fatal: Not a git repository (or any of the parent directories): .git

    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at source_version.js (packages/vulcan:lib/lib/server/source_version.js:11:73)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
    at site.js (packages/vulcan:lib/lib/server/site.js:1:397)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
    at main.js (packages/vulcan:lib/lib/server/main.js:1:88)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at require (packages/modules-runtime.js:258:21)
    at /built_app/programs/server/packages/vulcan_lib.js:6770:15
    at /built_app/programs/server/packages/vulcan_lib.js:6777:3
    at /built_app/programs/server/boot.js:411:36
    at Array.forEach (<anonymous>)
    at /built_app/programs/server/boot.js:220:19
    at /built_app/programs/server/boot.js:471:5
    at Function.run (/built_app/programs/server/profile.js:510:12)
    at /built_app/programs/server/boot.js:470:11
=> Starting meteor app on port:80
fatal: Not a git repository (or any of the parent directories): .git
/built_app/programs/server/node_modules/fibers/future.js:280
                        throw(ex);
                        ^

Error: Command failed: git rev-parse HEAD
fatal: Not a git repository (or any of the parent directories): .git

    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at source_version.js (packages/vulcan:lib/lib/server/source_version.js:11:73)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
    at site.js (packages/vulcan:lib/lib/server/site.js:1:397)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
    at main.js (packages/vulcan:lib/lib/server/main.js:1:88)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at require (packages/modules-runtime.js:258:21)
    at /built_app/programs/server/packages/vulcan_lib.js:6770:15
    at /built_app/programs/server/packages/vulcan_lib.js:6777:3
    at /built_app/programs/server/boot.js:411:36
    at Array.forEach (<anonymous>)
    at /built_app/programs/server/boot.js:220:19
    at /built_app/programs/server/boot.js:471:5
    at Function.run (/built_app/programs/server/profile.js:510:12)
    at /built_app/programs/server/boot.js:470:11
=> Starting meteor app on port:80
fatal: Not a git repository (or any of the parent directories): .git
/built_app/programs/server/node_modules/fibers/future.js:280
                        throw(ex);
                        ^

Error: Command failed: git rev-parse HEAD
fatal: Not a git repository (or any of the parent directories): .git

    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at source_version.js (packages/vulcan:lib/lib/server/source_version.js:11:73)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
    at site.js (packages/vulcan:lib/lib/server/site.js:1:397)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
    at main.js (packages/vulcan:lib/lib/server/main.js:1:88)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at require (packages/modules-runtime.js:258:21)
    at /built_app/programs/server/packages/vulcan_lib.js:6770:15
    at /built_app/programs/server/packages/vulcan_lib.js:6777:3
    at /built_app/programs/server/boot.js:411:36
    at Array.forEach (<anonymous>)
    at /built_app/programs/server/boot.js:220:19
    at /built_app/programs/server/boot.js:471:5
    at Function.run (/built_app/programs/server/profile.js:510:12)
    at /built_app/programs/server/boot.js:470:11

To see more logs type 'mup logs --tail=200'

=> Redeploying previous version of the app

[1.2.3.4] x Verifying Deployment: FAILED

          ------------------------------------STDERR------------------------------------
          odules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
        at main.js (packages/vulcan:lib/lib/server/main.js:1:88)
        at fileEvaluate (packages/modules-runtime.js:336:7)
        at Module.require (packages/modules-runtime.js:238:14)
        at require (packages/modules-runtime.js:258:21)
        at /built_app/programs/server/packages/vulcan_lib.js:6770:15
        at /built_app/programs/server/packages/vulcan_lib.js:6777:3
        at /built_app/programs/server/boot.js:411:36
        at Array.forEach (<anonymous>)
        at /built_app/programs/server/boot.js:220:19
        at /built_app/programs/server/boot.js:471:5
        at Function.run (/built_app/programs/server/profile.js:510:12)
        at /built_app/programs/server/boot.js:470:11
    => Starting meteor app on port:80
    fatal: Not a git repository (or any of the parent directories): .git
    /built_app/programs/server/node_modules/fibers/future.js:280
                            throw(ex);
                            ^

    Error: Command failed: git rev-parse HEAD
    fatal: Not a git repository (or any of the parent directories): .git

        at checkExecSyncError (child_process.js:601:13)
        at Object.execSync (child_process.js:641:13)
        at source_version.js (packages/vulcan:lib/lib/server/source_version.js:11:73)
        at fileEvaluate (packages/modules-runtime.js:336:7)
        at Module.require (packages/modules-runtime.js:238:14)
        at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
        at site.js (packages/vulcan:lib/lib/server/site.js:1:397)
        at fileEvaluate (packages/modules-runtime.js:336:7)
        at Module.require (packages/modules-runtime.js:238:14)
        at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
        at main.js (packages/vulcan:lib/lib/server/main.js:1:88)
        at fileEvaluate (packages/modules-runtime.js:336:7)
        at Module.require (packages/modules-runtime.js:238:14)
        at require (packages/modules-runtime.js:258:21)
        at /built_app/programs/server/packages/vulcan_lib.js:6770:15
        at /built_app/programs/server/packages/vulcan_lib.js:6777:3
        at /built_app/programs/server/boot.js:411:36
        at Array.forEach (<anonymous>)
        at /built_app/programs/server/boot.js:220:19
        at /built_app/programs/server/boot.js:471:5
        at Function.run (/built_app/programs/server/profile.js:510:12)
        at /built_app/programs/server/boot.js:470:11
    => Starting meteor app on port:80
    fatal: Not a git repository (or any of the parent directories): .git
    /built_app/programs/server/node_modules/fibers/future.js:280
                            throw(ex);
                            ^

    Error: Command failed: git rev-parse HEAD
    fatal: Not a git repository (or any of the parent directories): .git

        at checkExecSyncError (child_process.js:601:13)
        at Object.execSync (child_process.js:641:13)
        at source_version.js (packages/vulcan:lib/lib/server/source_version.js:11:73)
        at fileEvaluate (packages/modules-runtime.js:336:7)
        at Module.require (packages/modules-runtime.js:238:14)
        at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
        at site.js (packages/vulcan:lib/lib/server/site.js:1:397)
        at fileEvaluate (packages/modules-runtime.js:336:7)
        at Module.require (packages/modules-runtime.js:238:14)
        at Module.moduleLink [as link] (/built_app/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:38:38)
        at main.js (packages/vulcan:lib/lib/server/main.js:1:88)
        at fileEvaluate (packages/modules-runtime.js:336:7)
        at Module.require (packages/modules-runtime.js:238:14)
        at require (packages/modules-runtime.js:258:21)
        at /built_app/programs/server/packages/vulcan_lib.js:6770:15
        at /built_app/programs/server/packages/vulcan_lib.js:6777:3
        at /built_app/programs/server/boot.js:411:36
        at Array.forEach (<anonymous>)
        at /built_app/programs/server/boot.js:220:19
        at /built_app/programs/server/boot.js:471:5
        at Function.run (/built_app/programs/server/profile.js:510:12)
        at /built_app/programs/server/boot.js:470:11

    => Redeploying previous version of the app

          ------------------------------------STDOUT------------------------------------
          Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    Container has no IP Address, likely from the app crashing.
    => Container status:
    restarted: 7 times {"Bridge":"","SandboxID":"8e5201f41d21ba1ba46d1c5b59f5bedf3b32f8ed895d2925b78566aceaa324c9","HairpinMode":false,"LinkLocalIPv6Address":"","LinkLocalIPv6PrefixLen":0,"Ports":{},"SandboxKey":"/var/run/docker/netns/8e5201f41d21","SecondaryIPAddresses":null,"SecondaryIPv6Addresses":null,"EndpointID":"","Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","MacAddress":"","Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"2f362d40f970fc65542626cdc33be53d7fca464a1173aca1e7cb1bde9e856cac","EndpointID":"","Gateway":"","IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"","DriverOpts":null}}} {"Status":"restarting","Running":true,"Paused":false,"Restarting":true,"OOMKilled":false,"Dead":false,"Pid":0,"ExitCode":1,"Error":"","StartedAt":"2018-12-14T12:26:05.726805139Z","FinishedAt":"2018-12-14T12:26:08.702969595Z"}
    => Logs:

    To see more logs type 'mup logs --tail=200'

          ------------------------------------------------------------------------------
zodern commented 5 years ago

Vulcan can instead use the SOURCE_VERSION environment variable. Try adding the code from https://github.com/zodern/meteor-up/issues/807#issuecomment-346915622 to your config.

SachaG commented 5 years ago

Yes, what happened is that I wanted to make this work both if you're running a Mup deployment, or locally when working in dev mode. But I forgot to address the case where you're deploying but without setting the env variable… I've just pushed a Vulcan update that wraps it in a try/catch block to avoid this issue:

export const getSourceVersion = () => {
  try {
    return (
      process.env.SOURCE_VERSION ||
      childProcess
        .execSync('git rev-parse HEAD')
        .toString()
        .trim()
    );
  } catch (error) {
    return null;
  }
};
salazarpardo commented 5 years ago

@SachaG @zodern Thank you both for your help! I updated Vulcan and was able to deploy my site successfully!