Devserver reference

From Nasqueron Agora

Nasqueron Operations SIG maintains devservers. They offer a remote development environment for Nasqueron and open source projects.

General information

What server to use?

  • WindRiver, for any general-purpose task
  • Ysul, for webserver-legacy sites
  • Dwellers, for Docker development
  • Eglide, if you need an IRC session

How to get access?

You can ask it on DevCentral.

To speed up the process, you can follow NOG instructions at Operations grimoire/Create and revoke user accounts on Salt servers and send a commit to Differential against our operations repository.

Groups to use
Server Group name Description
Ysul / WindRiver nasquenautes for general purpose development
Dwellers dev-docker for Docker development (group still to create)
Eglide shell for IRC purpose

Userland

FreeBSD

Normally, devservers run under FreeBSD. That means your userland is a BSD one, and some commands arguments can be different if you're used to Linux. GNU coretools utilities are installed and prefixed by the letter g, e.g. gmake or gsed.

The most useful GNU commands are:

 * gmake when the Makefile has been written for GNU make
 * gsed -i to perform inline replacements
 * gwatch (/usr/sbin/watch allows the user to examine all data coming through a specified tty, that's quite different)

Note grep is the BSD one, but documented to be GNU compatible.

Directories

  • Use your /home/luser directory for anything personal
  • Use /srv or /var when you need to share something, that generally requires a Salt config to give shared rights to that directory
  • /var/51-wwwroot on Ysul is to use instead of your home folder for staging area of web applications you want to serve

tmux

  • You can use reptyr <pid> to attach a process spawned outside a tmux session in one
  • tmux cheat sheet

Databases

MariaDB

Works on server with the devserver-mysql role.

You've access to test_% databases, so you can without any specific configuration use that for unit tests. It's even OK to connect without login or password for the test_% namespace.

If you need any other database and app config, you can request it on DevCentral.

For long term projects, you can also specify where you want the credentials to be be provisioned, or request a Vault AppRole for your application to fetch them securely.

Rust

Rustup

If you wish to have control of what stable and nightly Rust versions to use, you can use Rustup.

To use it, the command rustup-init is available as an alternative to the curl magic documented on the Rustup web site (actually it's a fairly recent version of that script saved locally).

cargo, rustc

If you're OK with the Rust version installed by OS packages, feel free to call directly cargo or rustc.

Documentation

You can generate project documentation with the `cargo doc` command.

PHP

Tools provided

The following software are maintained as phar or repository clones in /opt:

  • psysh, REPL shell to test PHP code (with PHP documentation available at /usr/local/share/psysh/php_manual.sqlite)
  • psalm, for static analysis
  • doctum and phpdoc (phpDocumentor) to generate documentation
  • phpunit
  • phpcs

Most of those tools have wrappers in /usr/local/bin trying to detect if a version is installed locally for the PHP project through Composer and switching to that version if available.

So by running "phpunit", you'll run your Composer version and the system version when missing.

Documentation

To generate documentation for your code, phpdoc and doctum commands are available, including GraphViz and PlantUML for phpDocumentor classes graphes.

Personal notes

You can add in this section links to your own personal notes to use the devserver for your activities, including ideally a disaster recovery plan (how do you reinstall the code your work with?)

Troubleshoot

You've lost a file

Your home directory has snapshots every 5 minutes, you can get back your recently lost file from a read-only snapshot:

   cd ~/.zfs/snapshot
   ls

Those are folders with your home directory content as it was at the snapshot time, you can even diff files to spot differences:

   cd zfs-auto-snap_hourly-2023-06-05-20h00
   diff -u dev/nasqueron/operations/alkane/Jenkinsfile ~/dev/nasqueron/operations/alkane/Jenkinsfile

You've 12 months to act if your file is already in a monthly snapshot, but only 2 hours if it's in the last frequent snapshot and you keep modifying files, so act as quick as possible, ie right now. If you can't act right now, at least save the snapshot having the file (check that to avoid to save the wrong one) you want to recover with zfs hold:

   zfs hold keep arcology/usr/home/dereckson@zfs-auto-snap_hourly-2023-06-05-22h00

SSH issues

If you've a message like username@windriver.nasqueron.org: Permission denied (publickey)., it can means:

  • No SSH key has been offered
  • SSH keys have been offered, but not recognized by the server
  • SSH key is in a non-standard path - launch a SSH agent if needed (you've already one with your desktop engine), then ssh-add <path to key>
  • SSH key is protected by a passphrase and you don't remember the password
    • Solution 1. Try to remember the password, with an agent and ssh-add, it will be less confusing as you'll work locally
    • Solution 2. Destroy the SSH key, create a new one, request to add that new key, login or ssh-add each day for one week to remember it