Devserver reference: Difference between revisions

From Nasqueron Agora
Line 50: Line 50:
=== tmux ===
=== tmux ===
* You can use <code>reptyr <pid></code> to attach a process spawned outside a tmux session in one
* You can use <code>reptyr <pid></code> to attach a process spawned outside a tmux session in one
* [https://gist.github.com/MohamedAlaa/2961058 tmux cheat sheet]


== Databases ==
== Databases ==

Revision as of 18:31, 3 June 2023

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.

Troubleshoot

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