Giter VIP home page Giter VIP logo

balena-nodejs-hello-world's People

Contributors

acostach avatar alisondavis17 avatar balena-ci avatar camerondiver avatar chrissantamaria avatar chrisys avatar dansku avatar emirotin avatar flowzone-app[bot] avatar garethtdavies avatar imrehg avatar joscha avatar lucianbuzzo avatar moranf avatar nucleardreamer avatar page- avatar pcgeek86 avatar shaunmulligan avatar stathismor avatar tmigone avatar vipulgupta2048 avatar zwalchuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

balena-nodejs-hello-world's Issues

Build fails after adding "pi-pins" library

After trying to integrate this tutorial with the gpio project that resin provides, i installed pi-pins library and changed the tag to "latest".

The build failed with the following message:

Logs:
[Build]    make: Leaving directory '/usr/src/app/node_modules/rpio/build'
[Build]    npm notice created a lockfile as package-lock.json. You should commit this file.
[Build]    added 45 packages in 60.025s
[Build]    npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
[Build]    npm ERR!
[Build]    npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.
[Build]
[Build]    npm ERR! A complete log of this run can be found in:
[Build]    npm ERR!     /root/.npm/_logs/2017-07-18T21_25_32_580Z-debug.log
[Build]    Removing intermediate container f73ab0942b9b
[Error]    Build failed: The command '/bin/sh -c JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*' returned a non-zero code: 1
End of Logs

Obviously the problem occured by this command:
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*

I solved this temporary by replacing the previous command in the Dockerfile with:
`RUN npm install --force'

My project is working fine now, but i really don't know why the "default" RUN command fails.

Build fails because of changes in npm@5

[Success]  Base image pulled
[Info]     Starting Dockerfile build
[Build]    Step 1 : FROM resin/raspberrypi3-node:slim
[Build]     ---> 15b3ddada744
[Build]    Step 2 : WORKDIR /usr/src/app
[Build]     ---> Running in 9f88a0dfa634
[Build]     ---> 2d41387fc790
[Build]    Removing intermediate container 9f88a0dfa634
[Build]    Step 3 : COPY package.json package.json
[Build]     ---> 0fe5fcb88a8e
[Build]    Removing intermediate container 7a2888191de4
[Build]    Step 4 : RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*
[Build]     ---> Running in 75245dd8439c
[Info]     Still working...
[Build]    npm notice created a lockfile as package-lock.json. You should commit this file.
[Build]    added 42 packages in 25.594s
[Build]    npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
[Build]    npm ERR!
[Build]    npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.
[Build]    
[Build]    npm ERR! A complete log of this run can be found in:
[Build]    npm ERR!     /root/.npm/_logs/2017-06-14T10_45_23_144Z-debug.log
[Build]    Removing intermediate container 75245dd8439c
[Error]    Build failed: The command '/bin/sh -c JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*' returned a non-zero code: 1

Build is broken and Node.js simple server service fails for Siemens SIMATIC IOT2000

Scenario

I'm testing the simple server node application at https://github.com/balena-io-projects/simple-server-node on a Siemens SIMATIC IOT2040 (IOT2000 series) provisioned on balena.io.

I've been following the getting started guide at https://www.balena.io/docs/learn/getting-started/iot2000/nodejs/#adding-your-first-device.

I managed to provision the device successfully.

Problem(s) and some quick fixes

When I build (and deploy) the simple server node container on Balena I observe the following error:

$ git push balena master
Total 0 (delta 0), reused 0 (delta 0)

[Info]     Starting build for first-simatic-iot-2040-app, user [OMIT]
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/1493325/devices
[Info]     Building on x64_01
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[main]     Step 1/7 : FROM balenalib/iot2000-node:10-stretch-run
[main]     manifest for balenalib/iot2000-node:10-stretch-run not found
[Error]    Some services failed to build:
[Error]      Service: main
[Error]        Error: manifest for balenalib/iot2000-node:10-stretch-run not found
[Error]    Not deploying release.

remote: error: hook declined to update refs/heads/master
To [OMIT]@git.balena-cloud.com:[OMIT]/first-simatic-iot-2040-app.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to '[OMIT]@git.balena-cloud.com:[OMIT]/first-simatic-iot-2040-app.git'

The build fails because tag 10-stretch-run does not exist for image balenalib/iot2000-node.

Furthermore, when I swap from 10-stretch-run to an existing tag such as 6.17.1-buster-build-20190503, the build process fails with the following errors:

$ git push balena master --force
Total 0 (delta 0), reused 0 (delta 0)

[Info]     Starting build for first-simatic-iot-2040-app, user [OMIT]
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/1493325/devices
[Info]     Building on x64_01
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[main]     Step 1/7 : FROM balenalib/iot2000-node:6.17.1-buster-build-20190503
[main]      ---> 0d75afc627c7
[main]     Step 2/7 : WORKDIR /usr/src/app
[main]      ---> d235a409ac1f
[main]     Removing intermediate container 9396d61891e8
[main]     Step 3/7 : COPY package.json package.json
[main]      ---> 633641444b59
[main]     Removing intermediate container 0e72391c6b4e
[main]     Step 4/7 : RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*
[main]      ---> Running in 8270a9ac8844
[main]     [email protected] /usr/src/app
[main]     ├── [email protected]
[main]     └─┬ [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├─┬ [email protected]
[main]       │ │ └── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├── [email protected]
[main]       │ ├─┬ [email protected]
[main]       │ │ ├── [email protected]
[main]       │ │ └── [email protected]
[main]       │ ├─┬ [email protected]
[main]       │ │ └── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├── [email protected]
[main]       │ ├── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       └── [email protected]
[main]     npm
[main]      ERR! Usage: npm cache add <tarball file>
[main]     npm
[main]     ERR! npm cache add <folder>
[main]     npm ERR!
[main]      npm cache add <tarball url>
[main]     npm
[main]      
[main]     ERR! npm cache add <git url>
[main]     npm ERR! npm cache add <name>@<version>
[main]     npm
[main]      ERR! npm cache ls [<path>]
[main]     npm ERR! npm cache clean [<pkg>[@<version>]]
[main]     
[main]     Removing intermediate container 8270a9ac8844
[Info]     Uploading images
[main]     The command '/bin/sh -c JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*' returned a non-zero code: 1
[Success]  Successfully uploaded images
[Error]    Some services failed to build:
[Error]      Service: main
[Error]        Error: The command '/bin/sh -c JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*' returned a non-zero code: 1
[Error]    Not deploying release.

remote: error: hook declined to update refs/heads/master
To [OMIT]@git.balena-cloud.com:[OMIT]/first-simatic-iot-2040-app.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to '[OMIT]@git.balena-cloud.com:[OMIT]/first-simatic-iot-2040-app.git'

I can workaround this error by running a plain npm install.

Following this configuration, the image builds on Balena Cloud, and is deployed to the Siemens SIMATIC IOT2040 device:

$ git push balena master
Counting objects: 175, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (97/97), done.
Writing objects: 100% (175/175), 403.25 KiB | 0 bytes/s, done.
Total 175 (delta 88), reused 143 (delta 70)
remote: Resolving deltas: 100% (88/88), done.

[Info]     Starting build for first-simatic-iot-2040-app, user [OMIT]
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/1493325/devices
[Info]     Building on x64_01
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[main]     Step 1/7 : FROM balenalib/iot2000-node:6.17.1-buster-build-20190503
[main]      ---> 0d75afc627c7
[main]     Step 2/7 : WORKDIR /usr/src/app
[main]     Using cache
[main]      ---> 78eed34ca76e
[main]     Step 3/7 : COPY package.json package.json
[main]     Using cache
[main]      ---> e4457d5c4b2f
[main]     Step 4/7 : RUN npm install
[main]      ---> Running in c1df313d8db0
[main]     [email protected] /usr/src/app
[main]     ├── [email protected]
[main]     └─┬ [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├─┬ [email protected]
[main]       │ │ └── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├── [email protected]
[main]       │ ├─┬ [email protected]
[main]       │ │ ├── [email protected]
[main]       │ │ └── [email protected]
[main]       │ ├─┬ [email protected]
[main]       │ │ └── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ ├── [email protected]
[main]       │ ├── [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├── [email protected]
[main]       ├─┬ [email protected]
[main]       │ └── [email protected]
[main]       ├── [email protected]
[main]       └── [email protected]
[main]      ---> aa31e13ee8ba
[main]     Removing intermediate container c1df313d8db0
[main]     Step 5/7 : COPY . ./
[main]      ---> 123a4ede8b03
[main]     Removing intermediate container c407ee15933e
[main]     Step 6/7 : ENV UDEV 1
[main]      ---> Running in b472a4a4d9ae
[main]      ---> 74c2ba822cb8
[main]     Removing intermediate container b472a4a4d9ae
[main]     Step 7/7 : CMD npm start
[main]      ---> Running in 2c34f2586be7
[main]      ---> 99c710e9402b
[main]     Removing intermediate container 2c34f2586be7
[main]     Successfully built 99c710e9402b
[Info]     Uploading images
[Success]  Successfully uploaded images
[Success]  Release successfully created!
[Info]     Release: 70088570351f57da91ae454a2670f45b3f2a52ee (id: 994674)
[Info]     ┌─────────┬────────────┬────────────┐
[Info]     │ Service │ Image Size │ Build Time │
[Info]     ├─────────┼────────────┼────────────┤
[Info]     │ main    │ 705.74 MB  │ 7 seconds  │
[Info]     └─────────┴────────────┴────────────┘
[Info]     Build finished in 14 seconds
			    \
			     \
			      \\
			       \\
			        >\/7
			    _.-(6'  \
			   (=___._/` \
			        )  \ |
			       /   / |
			      /    > /
			     j    < _\
			 _.-' :      ``.
			 \ r=._\        `.
			<`\\_  \         .`-.
			 \ r-7  `-. ._  ' .  `\
			  \`,      `-.`7  7)   )
			   \/         \|  \'  / `-._
			              ||    .'
			               \\  (
			                >\  >
			            ,.-' >.'
			           <.'_.''
			             <'

To [OMIT]@git.balena-cloud.com:[OMIT]/first-simatic-iot-2040-app.git
 * [new branch]      master -> master

However, the service keeps failing on the device, so that the simple server node Web page is never available at the public URL:

$ curl https://[OMIT].balena-devices.com/
<!DOCTYPE html><html><head><meta charset="utf8">
<!-- [...] -->
<p><code>tunneling socket could not be established: socket hang up</code></p>
<p>One possible reason is because nothing is listening on port 80 on the device.</p><p><a class="btn btn-block btn-info" href="">RETRY</a></p></div><div class="footer"><p>Device Public URLs is a <a href="https://balena.io"><strong>balena.io</strong></a>
feature that provides individual URLs for balena.io-connected devices.
The feature is opt-in: no devices are exposed without the application owner's permission.</p>
<p><strong>balena.io</strong> does not serve anything on this URL, we just
proxy all the requests to whatever is listening on the device. This means
that the creator of the application is responsible for running a web-server

When I attempt to securely log in to the service from Balena Cloud, the operation fails because the service is not running:

Connecting to 58aca91762244c0a019d162aa3e0460e...
Spawning shell...
Error response from daemon: Container cc2cd177ca7ee3ddf67597668af84835718909afcf76fb8638f2ed1e1f4db129 is restarting, wait until the container is running
Error response from daemon: Container cc2cd177ca7ee3ddf67597668af84835718909afcf76fb8638f2ed1e1f4db129 is restarting, wait until the container is running
SSH session disconnected
SSH reconnecting...
Spawning shell...
Error response from daemon: Container cc2cd177ca7ee3ddf67597668af84835718909afcf76fb8638f2ed1e1f4db129 is restarting, wait until the container is running
Error response from daemon: Container cc2cd177ca7ee3ddf67597668af84835718909afcf76fb8638f2ed1e1f4db129 is restarting, wait until the container is running
SSH session disconnected

I have not investigated this specific problem further.

Proposed solution(s)

The straightforward solution is to align the base images for all architectures.

However, being new to Balena, I'm not sure why there is no Node v. 10 base image for Siemens SIMATIC IOT2000.

Alternatively, different branches in the git repo could be created for different architectures, so that each can be config w/ relevant base image tag.

I don't have a proposed solution for the failing service.

Next actions

Once we get a first round of discussion on these problems (missing base image, failing npm command, and service unavailable), we can split them accordingly into three separate issues.

I'll be glad to discuss this further, and help implement an agreed-upon fix.

Doesn't Work with Raspberry Pi 3

Seeing some errors pushing this to a cluster of Pi3s. Getting this:

Failed to start application 'registry.resin.io/test/ea51fe33f7cac8af562919a5e1caed75235229f6' due to 'Application architecture incompatible with raspberrypi3: exec format error'

Update next steps projects

We've renamed the projects org now, so we can direct users to the balenalabs org instead, and perhaps embed some DWB buttons to encourage trying the next project.

Example doesn't work on beaglebone black

31.07.18 12:15:29 (-0400)  main  Systemd init system enabled.
31.07.18 12:15:29 (-0400)  main  Failed to insert module 'kdbus': Function not implemented
31.07.18 12:15:29 (-0400)  main  systemd 230 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
31.07.18 12:15:29 (-0400)  main  Detected virtualization docker.
31.07.18 12:15:29 (-0400)  main  Detected architecture arm.
31.07.18 12:15:29 (-0400)  main  Set hostname to <788b700>.
31.07.18 12:15:29 (-0400)  main  Cannot determine cgroup we are running in: No medium found
31.07.18 12:15:29 (-0400)  main  Failed to allocate manager object: No medium found
31.07.18 12:15:29 (-0400)  main  [!!!!!!] Failed to allocate manager object, freezing.
31.07.18 12:15:29 (-0400)  main  Freezing execution.

Seems like it's related to balena-io-library/base-images#342

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.