Generic development cli for various application types.


Keywords
devcontainer, devenv, django, fastapi, python
License
MIT
Install
pip install devious==0.10.0

Documentation

ABOUT

Visual Studio Code devcontainer-based development environment configuration, featuring a Python command line application (tools/devious) to develop web applications and configure remote machines for deployment. Note: devious is developed in the context of this project and also available from PyPI.

Currently supports the following application types:

  • Microservice: Configures remote machine with nginx as reverse proxy, deploys microservice(s) as docker container(s).
  • DjangoApp: Docker compose deployment with nginx as reverse proxy

USAGE

  • For usage as private repository, use the devious update command instead of syncing the fork, because it is not possible to fork privately due to git intrinsics. This detaches your repository from its remote (the devious repo), remove the devious development artifacts to facilitate integration of upstream changes (devious changes more rapidly and in a more complex way than the rest and should be fetched from PyPI instead) and leave the original devious remote configures as devious_upstream.
  • You can still get updates from the rest of the devious repo (excluding the tools/devious folder) with devious update.
  • (Optional) Configure devcontainer in .devcontainer/.env file (e.g. Python version).
  • Create your application with (see "dev create -h")
  • Register your applications in registered_targets.py.
  • Under some conditions (e.g. remote container without WSL2), the initializeCommand.sh must be executed manually on the target system for the first time
  • For remote containers via SSH, usage of ssh-agent is useful to cache your identities on a system
    • Windows: Get-Service ssh-agent | Set-Service -StartupType Automatic -PassThru | Start-Service, start-ssh-agent.cmd, ssh-add <private key>
    • Ubuntu: ssh-agent, ssh-add <private key>

x11

When building a devcontainer on a remote development machine, VSCode passes the local $DISPLAY variable instead of the $DISPLAY variable of the remote host. This leads to connection and even worse, authentication issues. To make it work, the .Xauthority on your remote host must contain a cookie for the display currently set to $DISPLAY on your remote host. This should be generated by regularly spinning up the container in a remote development session but can also be achieved at a later point by opening an independent ssh +X session to your remote host. Either way, the HOST_DISPLAY in initializeCommand.sh must be set to the $DISPLAY of your remote host and the container must be rebuilt.

Note: It will be necessary to again open a ssh +X session (or a new remote development session) after machine reboots and other environment changes and again set $HOST_DISPLAY, because the $DISPLAY variable on your remote might be volatile.

CONFIGURATION

Set configuration variables in .devcontainer/.env file:

  • DOCKER: true or false depending on if you want docker installed inside your devcontainer (docker in docker).
  • GPP_VERSION: false or g++ version (e.g. "11") to install C/C++ build tools (currently no supported application types in devious).
  • CUSTOM_PYTHON_VERSION: "default" for ubuntu distribution default or specific version (e.g. "3.10.6") to build from source.
  • UBUNTU_VERSION: Specific version (e.g. "22.04")

Set user aliases

  • Put custom user aliases in .devcontainer/.config/.user_aliases if needed