Adding Digital Ocean Insights to droplet

The digital ocean instructions for adding their insights agent use the out of date apt-key mechanism

Installing using the latest method is simple – make sure the keyrings directory exists:

mkdir -p /etc/apt/keyrings

Then download the key and dearmour to the keyrings directory as follows:

curl https://repos.insights.digitalocean.com/sonar-agent.asc | sudo gpg --dearmour | sudo tee /etc/apt/keyrings/do-insights-repo.gpg > /dev/null

the create the repo source:

echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/do-insights-repo.gpg] https://repos.insights.digitalocean.com/apt/do-agent/ main main" | sudo tee /etc/apt/sources.list.d/digitalocean-agent.list

Then update the repos:

sudo apt update

Install the agent:

sudo apt install do-agent

Check it’s running using:

ps aux | grep do-agent

Now check on the Digital Ocean dashboard you should 5 graphs on the droplet’s Graphs tab instead of 3.

First Experience with new Pos_OS! cosmic desktop

The rust Pop_OS! cosmic desktop app written in Rust by the team an system 76 is currently in pre alpha but you can test it out. It’s probably not ready to use as your daily driver at present. Many thanks to Levi Portenier for his help via the Mattermost chat to allow me to get started with this.

Installation

make sure your system is up to date using the command:

sudo apt update && sudo apt upgrade

Enable Wayland by editing the /etc/gdm3/custom.conf and place a ‘#’ at the beginning of the line that reads WaylandEnable=false. Log out and select your username there should be a cog in the bottom right corner of the password entry page clicking on that should give the option for Pop on Wayland at the time I tested this it was not very stable and the tiled desktop did not work.

Once wayland has been enabled you can install the desktop from the standard repos using the command:

sudo apt install cosmic*

Log out and click on your user name, the cog on bottom right of the password entry screen now has a COSMIC option. Select that and enter your password.

At the time of writing there’s no dock available, the initial screen is quite minimal. At present keyboard control is required. Here are the shortcut I found (or was pointed to by Levi).

Keyboard shortcuts

Super + / – Open the launcher and to run an application by typing it’s name

Super + A – Open the App Library

Super + B – Open the default browser

Super + F – Open the file Manager

Super + G – In Tiled mode (see Super + Y) pop the current window out of the tiled framework. I could not see any way to send the window to the background at present, even when the background window is active.

Super + H – Move workspace to the left

Super + J – When windows are tiled vertically (see Super + O) move to the window above

Super + K – When windows are tiled vertically (see Super + O) move to the window below

Super + L – Move workspace to the right

Super + M – Toggle Maximise the current window

Super + O – Toggle horizontal or vertical tiling

Super + Q – Close the current window

Super + T – Open a terminal

Super + W – Display workspaces

Super + Y – Toggle tiled window

Clicking on the Power button displays a menu from there you can log out, power off and access the Cosmic Settings app (this is still in very early development so options are limited). There does not appear to be any way to adjust the resolution of the screen. I tested this in a VM and could not see any way to make the screen larger than 1024 x 768. According to Levi, this can be configured in /etc/cosmic-comp/config.ron but the default version does not contain any settings for resolution. The standard Gnome Settings app is still available from the application library but as you would expect the settings are not applied to the COSMIC desktop.

The window chrome does not have a maximise button – you can maximise by double clicking on the title bar. However maximised at present seems to cover the top bar.

The default keyboard layout seems to English US. I could not see a way to change this.

Salt Configuration Management Cheat sheet

Delete a user:

sudo salt ‘minion-name’ user.delete username remove=True force=True

Test states:

sudo salt ‘minion-name’ state.test

Useful master configuration

sudo vim /etc/salt/master.d/state-verbose.conf

state_verbose: False

sudo vim /etc/salt/master.d/timeout.conf

timeout: 15

Troubleshooting

Run minion in debug mode

sudo systemctl stop salt-minion

sudo salt-minion -l debug

Can’t perform a sudo salt ‘minion-name’ test.ping:

Log on to minion and set to run in debug if no communication from master check the value of `source address` in /etc/salt/minion.d/base.conf

Upgrading to Onedir (on Ubuntu)

Salt classic is being retired – it will not longer be packaged after version 3005. Onedir (which packages everything, including python, required to run salt in one directory) is the future. To upgrade a new gpg key is required.

Getting started with pnpm

For a long time, I thought why use a different node package manager like yarn – “npm (the package manager that’s installed when you install node) does the job, why make it more complicated?” Then I came across a project that said it installed best with pnpm, I decided to check it out and found it does add value. I’ve switched to using pnpm because it allow management of node which was previously a bit of a faff. Also, when one includes a package in a project it stores the package version in a central repo and adds a link to that package/version so next time you reinstall or use that package / version in another project it does not need to be downloaded again. It also takes care of global installations without using sudo or extra configuration. Check out the website for more benefits.

What follows is a very basic introduction to pnpm on Linux systems partly as an aid memoir to myself but hopefully you find it helpful too! These instructions should work for most Linux distros but I’ve only tried it out on Debian based ones so far.

Installing if you don’t already have node installed

If you don’t have node installed you can install pnpm and use that to install node rather adding the node repo to your system page manger and installing from there. To install so that you can manage node use the command:

curl -fsSL https://get.pnpm.io/install.sh > pnpm-install.sh
# view the file to make sure you're happy running it on your computer
sh ./pnpm-install.sh

or if you don’t have curl you can use “wget -O- https://get.pnpm.io/install.sh | sh -” instead.

You can install the current LTS version of node using the command (other options in place of “lts” allow installing other versions, see the pnpm website for details):

pnpm env use --global lts

Installing if you already have node installed

You can use the script above if you’ve already got node installed however there are also a couple of other If you have a recent version node (versions 16.13 onwards) you can use corepack, run the commands:

corepack enable
corepack prepare pnpm@latest –activate

Or you can install using npm:

npm install -g pnpm

Getting started

Command are often similar to their equivalent npm command and should be run from the project directory.

I find tab completion very useful, to install it for bash zsh or fish shells use the following (and then reload your shell using e.g. source ~/.bashrc or log out and back in again):

pnpm install-completion

To start a new project:

pnpm init

To convert an existing project using a package-lock.json:

pnpm import

To install an existing project – this read from an existing pnpn-lock.yaml to get version information (if it exists, it it does not exist it will be created – you should add this file to your :

pnpm install

Adding dependencies to a project is slightly different to npm. To add a development only dependency use the add command and append “–save-dev” as below, you can optionally specify a tag, version or version range:

pnpm add <package name>[@<tag>|@version>|@<version range>] –save-dev

Add a production dependency (the default add action)

pnpm add <package name>[@<tag>|@version>|@<version range>]

Removing the installed packages is similar to npm (though as pnpm creates links to a central repository it only removed the links to these packages)

pnpm remove <package name>

To run a script you can use the same syntax as npm (pnpm run <script defined in package.json>) but unless your script is a keyword used by pnpm you can simply use:

pnpm <script defined in package.json>

Thanks for reading

I find pnpm much is an improved package manager compared to npm, hopefully you’ve found this useful as an introduction.

Enjoy!

Update your apt keys for Ubuntu and other Debian based operation systems

You may get a warning from a modern Debian based operating system which says:

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

Essentially the apt-key framework is being retired and you need to store your keys in separate files in the /etc/apt/trusted.gpg.d/ directory rather than using apt-key to manage

If when you run:

sudo apt-key list

Any keys listed under the heading of

/etc/apt/trusted.gpg

should be migrated. This procedure is described below. Before you start make sure the keyrings directory exists (not required if you are using Ubuntu 22.04)

sudo mkdir -p /etc/apt/keyrings

From the list produced by the “apt-key list” command, a key can be uniquely identified by the last 2 sets of hexidecimal numbers on the second line of the pub section. For example if the numbers are DE57 BFBE you can use the string DE57BFBE to identify the key. So you can export it using the following command (replace the DE57BFBE with the actual last digits of the key and <repo-name> with a unique name in that directory):

sudo apt-key export DE57BFBE | sudo gpg --dearmour -o /etc/apt/keyrings/<repo-name>.gpg

You can then update the repository definition to use this key. for example if your repo was:

deb [arch=amd64] https://repo.awesome.io/repo/py3/ubuntu/22.04/amd64/latest jammy main

and you used the filename awesome.gpg then you’d enter:

deb [signed-by=/etc/apt/keyrings/awesome.gpg arch=amd64] https://repo.awesome.io/repo/py3/ubuntu/22.04/amd64/latest jammy main

You can then list the key using “sudo apt-key list” – and use “sudo apt update” to update your apt indexes.

With all that working delete the old key from the trusted.gpg using the command:

sudo apt-key del DE57BFBE

Enjoy!