Skip to content

Conversation

@MPParsley
Copy link
Owner

Documentation for mu-semtech#47.

MPParsley and others added 30 commits January 20, 2023 12:42
* Allow overriding port and hostname

* Update server.js

* Update Dockerfile
* Allow overriding port and hostname

* Update server.js

* Update Dockerfile

* Update Dockerfile

* Update README.md
also moves to buildx which should give us arm64 support as well
Shifting to debian means we need to explicitly use bash.

When using the node debugger through chromium based browsers (such as
Brave) the node debugger fails to connect to the nodejs inspector.
Together with @erikap we inspected the packets and it seems nodejs does
not accept incoming connections on the ipv6 address as its hostname.  It
is unclear why it does so.  It does accept connections on the specific
ipv4 address 127.0.0.1.  Searching for solutions it seems Debian
Bookworm uses different basic settings (though it is unclear which those
are exactly) that do make this case work.

In case of alpine there seems to be an ipv6 incompatibility.  Explicitly
adding 127.0.0.1:9229 as an inspect target makes things work.
Explicitly binding an ipv4 port in Docker (making it drop the IPv6 port)
makes things work too.  Using an older NodeJS version (up to alpine
node:15) also makes it work.  We therefore conclude this is a
compatibility issue and decide not to dig further.

We have dug into the packages.  We have searched online.  People seem to
accept this is the state of NodeJS and lacking deep dive guides
regarding nodejs, this seems to be the most straight path forward.
Based on comments from @Windvis it makes sense to bump the decorators
now rather than later when more legacy decorators would be used.  We're
thus shifting the (currently latest) version 2023-05.

/cc: @erikap
`$CI_COMMIT_SOURCE_BRANCH` is only set in a PR context and not in a regular push context. In a regular push context `$CI_COMMIT_BRANCH` should be used
New features since 1.6.0:
- Upgrade to Node 18
- Decorators support changed to proposed version 2023-05 (expect to be
updated in the future)
- Allow overriding hostname and port
- Documentation on handling delta's in a microservice
- Setup automated builds with Woodpecker
it makes sense for base images to support a wider set of platforms.
* Adapted README to divio

* Imported Building a microservice with Express

* Split tutorials and add how-to guides

* Update reference documentation on framework and imports

* Move adding dependencies and delta handling from refernce to how-to's

---------

Co-authored-by: Erika Pauwels <[email protected]>
Add documentation on custom build commands in startup.sh
When compiling copy over the non compilable files. typically these are
supporting files like json files, hbs, templates, ... that are expected by the app.
erikap and others added 11 commits June 25, 2025 16:18
No functional change. Being consistent with syntax in existing files.
We don't need a separate image for running the scripts.  The latest mu-cli will
run the scripts in the current image which is good enough for this purpose.
- No race conditions on restart
- Generate package-lock.json for service dependencies
- Auto-install node_modules for development
- Correctly use npm install and npm ci on first start and reload

Co-author @madnificent
node_modules should be recreated when building production.
beforeExit allows to run a series of commands before exit occurs.  The function
is async.

- setExitHandler is an unpublished escape hatch not intended for public use
- exitHandler is not intended for public use but is necessary in start-server.js
  which has been given its own file

nodemon has been removed

watchman has its own set of issues.  It is not clear when they appear exactly
but the issues suggest our current approach may work in our current setting.
Because we have not seen any extra errors during testing we'll accept this as
being as good as it gets.  We switched because nodemon has some open issues and
we could not get it to reliably forward signals necessary to clean up state
during development.
Needed updates because it uses internals.
Removed console.log which wasn't needed and updated variable names so code
checkers are happier.
Could find no uses of these prefixes in the wild so there is a very slim chance
this is breaking.  It may however break within new microservices because mu is
not defined to be the commonly accepted value for the prefix.  Better be
explicit for now.
This script at least ensures it looks the same in various services.  A more
streamlined solution may be preferred in the future.
buildx sets the env var if we specify it.  Regular docker build doesn't seem to
do so.  This solution is not pretty but it tackles the cases we're trying to
support now.  Perhaps this will make Apple happy.
New features since 1.8.0:

- Support for mu auth scopes
- Built-in sudo interface
- Faster reloads and faster compilation
- Code editor hints in dev mode through auto-population of local node_modules
- Experimental support for debugger in some editors
- Use of package-lock.json for your own sources (auto-generated during dev)
- Much faster stopping and reloading
- Support for cleaning up when your service stops
- The mu package can now be imported without spinning up a server
- Packages in package.json are auto-installed without requiring manual restart
- Removal of non-standard PREFIXES from standard queries
- ES6 Module support
erikap and others added 4 commits August 22, 2025 11:37
Fixes:
- fix service start when running in dev mode without mounted config folder
small fix to the readme: correct code snippet
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

Successfully merging this pull request may close these issues.

9 participants