Skip to main content

Deploy and set up Docker Compose based web apps with Ansible

Project description

Docksible

About

This is a tool you can run locally to install a given web app via Docker Compose onto a remote VPS. Though not recommended for serious enterprise grade production environments, it is well suited to quickly spin up an off the cuff demo server, or even a small production server.

Warning

This tool is still under development and not stable yet. Until version 1.0 becomes available, things can and will break between releases.

Features

  • WordPress
  • Redmine (open source issue tracker)
  • SSL
  • SSH proxy to tunnel hidden services like database
  • Hopefully more soon ;-)

Requirements

  • Local: Unix with Python 3.9 or newer. Tested this on Gentoo and Ubuntu Linux. Might work on macOS, but I don't know. Won't work on Windows, because it uses Ansible under the hood, which AFAIK is not supported for Windows.
  • Remote: VPS running Ubuntu, or maybe other Debian based flavor, reachable via SSH. It should probably work on all Debian distros, but I have only tested on Ubuntu.

Installing

Intall with Pip: python -m pip install docksible

Usage

These examples should be self explanatory:

  • docksible user@example.com wordpress --letsencrypt --email admin@example.com
  • docksible user@example.com redmine --letsencrypt --email admin@example.com

Run the --help flag for all supported options.

Using the SSH proxy

You can include a simple SSH proxy into your app's Docker network, by passing the --ssh-proxy-flag. This will drop in a small container that you can use to port forward some hidden services, like the database. Here's how to do it:

  • Include --ssh-proxy in the Docksible command (ex: docksible user@host wordpress --ssh-proxy)
  • Set up the proxy service's authorized_keys file. This will be improved in the future, but until then:
    • SSH into your server as root
    • Copy root's .ssh/authorized_keys into docksible-volumes/ssh-proxy-data/
    • Shell into the proxy container, and basically chown -R proxy_user:proxy_user /home/proxy_user. This could also be improved, but for now, just needs to be done once.
  • Now the proxy service is ready to use. For example:
    • Set up the tunnel to proxy the database:
    ssh -p 2222 proxy_user@yourserver.com -L 9000:docksible_db:3306
    
    • Connect to the database:
    mysql -u your_db_user -p --port=9000 --host=localhost --protocol=TCP
    

Known issues

When setting up a web app on Ubuntu 24.10 and newer, and doing so with the --letsencrypt flag, which is recommended, you must also set the --apparmor-workaround flag.

This because it seems that in Ubuntu 24.10 and newer, there is an issue with AppArmor that prevents Docker containers from being restarted, even when doing so as root, which occurs a few times in the Let's Encrypt role.

Setting the flag --apparmor-workaround will result in the raw command aa-remove-unknown being run on the server everytime before a container gets restarted. This workaround fixes the issue for now, but it is not elegant. Doing this on older versions results in a different error, hence the CLI option.

Altogether, it's tech debt, a temporary workaround, and will be removed soon. Also, the Let's Encrypt handling will be refactored and improved altogether. See these issues for more info:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docksible-0.9.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docksible-0.9.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file docksible-0.9.0.tar.gz.

File metadata

  • Download URL: docksible-0.9.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for docksible-0.9.0.tar.gz
Algorithm Hash digest
SHA256 ccd599bad5503b67c2b0addd9ef31e058d6973caa226e15cccde36436ab0db29
MD5 b6b0016f53afbe075c61db0d26e5f47f
BLAKE2b-256 1b4c1f109a553d57b636842ee9006e6cc2145fe2225868ae5d9a7df42f556708

See more details on using hashes here.

File details

Details for the file docksible-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: docksible-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for docksible-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6883bf3b68fceed7a07a8c34efdc461d2db55a2c74080237f01d325ae8103596
MD5 2f9ca461775dafbdc7fd4d71b99e7611
BLAKE2b-256 c0937da8d5f841e118dd0370b4059536a604ae96d1c40198c29c83ea292cce4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page