PHP’s defacto package manager, composer, has long required large amounts of memory to do updates for larger projects, often more than servers or virtual machines have. The script will die with an out of memory error, or more recently, the simple message “Killed”, and do no work in these situations. The normal procedure is to develop locally, deploy local lock file (composer.lock
) to the server, and run composer install
instead of update
. But I’ve recently moved to doing most of my development in VMs, so I have had to work around this problem to get things installed or updated. A swap file is the solution for Linux machines provided in the official docs and expanded in a StackOverflow answer.
packageManager posts
Unprivileged Homebrew install, 2021 edition
On my new MacBook, I’ve been isolating responsibilities into separate user accounts. This includes an unprivileged “manager” account for installing most global third-party software, and a few development accounts for different purposes. I use Homebrew to install some dev related software, but my old Homebrew setup didn’t work with this conceptually, nor with the more locked down privileges of newer Mac OS versions. I didn’t want to give Homebrew or its packages admin or root privileges, so I have adapted Homebrew’s untar anywhere method to install a globally available Homebrew using the unprivileged manager account, only requiring a privileged account briefly. I’ve also used untar anywhere for a per-account Homebrew install to allow each dev account to have custom versions of any desired packages, with no privileged account required.
Continue reading post "Unprivileged Homebrew install, 2021 edition"JS: ES Modules and Node bare specifiers via response rewrite
I’ve been playing with JS lately, including ES modules and building with Rollup, Babel, and Terser, along with other accessories. One thing I’m disappointed with of ES modules in the Nodejs ecosystem is dealing with third party imports. Using the “bare” specifiers that Node expects works fine in that environment and thus tools running in it (possibly needing helpers), but they don’t work at all directly in the browser. This is discussed in this post by Jake Archibold, for instance.
Import maps are one solution in the works, but that requires explicitly mapping every dependency, which could get complicated fast when dependencies have dependencies. It also is only in draft stage and only works in Blink based browsers currently.
I eventually gave in to the idea of having server code rewrite the paths in the js file responses to point to a symlinked node_modules
folder, similar to what is mentioned in this post by the Polymer project. I created a PHP test server for one of my projects that does this.
The installation of a new version of nodejs via MacPorts took nearly two hours.
Continue reading post "#3312"I guess npm doesn’t find a version of a package that matches the current environment when doing npm install whatever
.
Custom logic for unattended upgrades reboot
The Ubuntu / Debian unattended-upgrades
package has an option to automatically reboot as needed when it upgrades packages. It will do this without user input, at a chosen time. However, it doesn’t allow for any conditions beyond need and time. I found a need for more nuance recently, so I had to disable the built-in functionality and set up my own script on a cron job.
Automatically deal with conf changes using unattended-upgrades
For Ubuntu servers, I use the unattended-upgrades
package to automate keeping the system and packages up to date. I recently noticed some of Cogneato’s servers showing packages needing to be updated for multiple days. When I looked in unattended-upgrades.log
(in folder /var/log/unattended-upgrades/
), I found the message “WARNING Package something has conffile prompt and needs to be upgraded manually”. Basically, there was a change to a configuration file and it didn’t know how to handle it.
Homebrew install.sh without root
[Update]The following method no longer seems to work due to changes in the install.sh
script as well as locked down permissions in newer OS versions. Because of this and changes to my general setup, I have a new Homebrew setup that uses Homebrew’s untar anywhere method.[/Update]
I installed Homebrew, a Mac package manager, recently on my main computer.
Continue reading post "Homebrew install.sh without root"El Capitan Macports update
Finally updated Macports on my system after updating my OS in December.
Continue reading post "El Capitan Macports update"