Project Category: IT / Dev tools

  • Apache Logs Monitor for VS Code

    A simple VS Code extension to monitor Apache error logs in the Debug Console.

    Version: 1.0.0-beta3 VS Code: 1.74+ License: ISC

    What it does

    • Shows Apache error logs in VS Code Debug Console
    • Finds Apache sites automatically from /etc/apache2/sites-enabled/
    • Lets you switch between different site logs
    • Basic commands: select, all, stop, list

    Installation

    Quick install (recommended):

    No need to clone the repository, the install script will fetch the needed files.

    curl -fsSL https://raw.githubusercontent.com/magicoli/vscode-apache-logs-monitor/master/install.sh | bash

    Usage

    In the Debug Console, type:

    • select(1,2,3) – pick specific sites to monitor by number
    • all() – show logs from all sites
    • stop() – stop monitoring
    • list() – show available sites

    Requirements

    • Apache with standard Debian/Ubuntu config layout
    • Access to /etc/apache2/sites-enabled/ and log files
    • May need sudo for log file access

    Example

    
    [14:30:45] Starting Apache Logs Monitor...
    [14:30:45] Found sites: example.com, api.example.com
    [14:30:45] Monitoring: /var/log/apache2/example.com_error.log

    select

    1. example.com – /var/log/apache2/example.com_error.log
    2. api.example.com – /var/log/apache2/api.example.com_error.log Choose [1-2]: 2

    [14:31:02] Switching to: api.example.com [14:31:02] [error] [client 192.168.1.100] PHP Notice: Undefined variable

    Development

    git clone https://github.com/magicoli/vscode-apache-logs-monitor.git
    cd vscode-apache-logs-monitor
    npm install
    npm run compile
    npx vsce package

    Use ./dev.sh build to rebuild or ./dev.sh watch for auto-rebuild.

    Notes

    • This is a basic utility extension for Apache log monitoring
    • Works with standard Apache configurations on Debian/Ubuntu
    • For remote servers, install the extension on each server (not your local machine)
    • Uses VS Code’s Debug Adapter Protocol for console integration

    License

    ISC License – see LICENSE file.

  • Bash helpers

    Copyright 2015 Olivier van Helden olivier@van-helden.net. Released under GNU Affero GPL v3.0 license, unless otherwise stated. http://www.gnu.org/licenses/agpl-3.0.html

    A couple of useful tools for bash scripting.

    helpers

    Put this line at the beginning of your script (do not run the file directly, source it):

    . /path/to/helpers

    and use these functions inside the script

    end [errornumber] [message]
    log [errornumber] [message]
    readvar [var]
    yesno [-y] ["message"]
    ucfirst [string]

    ini_parser

    A tool to read .ini config in bash scripts

    let’s say you have a .ini file with this content

    [Default]
        name = "Albert"
    [Smart]
        name = "Einstein"

    Put this line at the beginning of your script (do not run the file directly, source it):

    . /path/to/ini_parser

    And, where you need it

    ini.parse /path/to/config/file.ini
    ini.section.Default
    echo $name

    Output: Albert

    Then, later… (no need to repeat ini.parse /path/to/config/file.ini)

    ini.section.Smart
    echo $name

    Output: Einstein

    Voilà ! (en français dans le texte)

    More details inside ini_parser

  • opensim-debian

    OpenSim Debian Distribution

    Version: 2.0.0

    This is an framework to facilitate installation and use of OpenSim with Debian.

    https://www.speculoos.world/opensim-debian-installation-framework/

    Features

    ./install/install.sh

    • create basic directory structure, download OpenSim and other needed libraries
    • read Robust default configuration, ask a few questions and build a working configuration in etc/robust-d

    opensim start

    • Start all instances, first in etc/robust-enabled, then in etc/simulators-enabled

    opensim start instance1 [instance2] [...]

    • Start only specified instances The config will be the first match in etc/robust.d/.ini or etc/opensim.d/.ini

    opensim stop [now] [instance1] [instance2] [...]

    opensim restart [now] [instance1] [instance2] [...]

    • Stop/Restart all instances or matching instances
    • If first parameter is "now", stops the simulator immediately, otherwise send reminders to leave during 2 minutes then stop

    opensim status

    • Show active instances, per instance and global memory and cpu usage

    Installation

    git clone --recursive https://git.magiiic.com/opensimulator/opensim-debian.git
    # use --recursive to download git submodules
    # if you don't use recursive, they will be downloaded during installation
    sudo mv opensim-debian /opt/
    export PATH=$PATH:/opt/opensim-debian/bin
    cd /opt/opensim-debian
    ./install/install.sh

    Answer the common setting questions.

    Configuration should be working as is, but you will probably want to adjust

    • ./etc/opensim/opensim.conf (main database configuration)
    • ./etc/opensim/robust.d/*.ini (robust settings)
    • ./etc/opensim/opensim.d/*.ini (simulators settings)
    opensim start

    To enable bash completion:

    sudo apt update
    sudo apt install bash-completion
    sudo ln -s /opt/opensim-debian/lib/bash_completion.d/opensim /etc/bash_completion.d/

    Main motivation

    In a software application, particularly a complicate one like OpenSim, some thing should never be stored at the same place. Essentially, there is a place for static files (executables, libraries), a place for preferences, and a place for data created by the application (permanent or temporary).

    This way, you can

    • easily update the software without touching preferences and data
    • backup the data without duplicating the software
    • avoid duplicating the application if you need to run several instances…

    So, we reorganised the files and folders, matching the general Linux standards.

    • The whole thing is stored in /opt/opensim-debian (could become /usr/share/opensim if we make a package), refferred as OSDDIR below
    • Scripts and utilities are in /OSDDIR/bin/
    • The main code (latest stable OpenSim release) is located in /OSDDIR/core/opensim (no, not in bin, because they are not directly executable on all OSes, and they rely on lot of other files around them)
    • Preferences are read from /OSDDIR/etc/ /etc/ and ~/etc/, each one overriding the precedent
    • Cache is stored in /OSDDIR/var/cache
    • Logs in /OSDDIR/var/logs
    • Databases (if using sqlite) should be store in var/db (but we don’t use sqlite, so this could be added or not later)
    • Git clone and other works in progress should go in dev/

    It was important to achieve this without altering the main OpenSim code. So we created some scripts which:

    • read the preferences in etc/
    • looks for instances to start in etc/robust.d and etc/opensim.d
    • tells OpenSim where to save data, cache and logs

    We have developed and used this setup for several years in Speculoos Grid and wanted to share. Although this was working for us, we don’t push the whole thing as is, as we want to make sure the methods are as globals as they can.