From 731af8a597eff6c21c6a0ea817980be6d5c8e511 Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 22 Oct 2020 14:29:16 -0500 Subject: [PATCH 1/9] Update changelog and FAQ --- capsulflask/templates/changelog.html | 23 ++--- capsulflask/templates/faq.html | 132 +++++++++------------------ 2 files changed, 53 insertions(+), 102 deletions(-) diff --git a/capsulflask/templates/changelog.html b/capsulflask/templates/changelog.html index 685bc5d..3c0edcc 100644 --- a/capsulflask/templates/changelog.html +++ b/capsulflask/templates/changelog.html @@ -8,18 +8,19 @@ {% block subcontent %}

{% endblock %} diff --git a/capsulflask/templates/faq.html b/capsulflask/templates/faq.html index 40f36f5..817e6ba 100644 --- a/capsulflask/templates/faq.html +++ b/capsulflask/templates/faq.html @@ -11,65 +11,34 @@

From 11160ad4f2b610754810977fb4ba4c4c432eea3d Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 22 Oct 2020 14:30:07 -0500 Subject: [PATCH 2/9] Change mailto links from halp to help --- capsulflask/templates/support.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/capsulflask/templates/support.html b/capsulflask/templates/support.html index ed16bd2..07888f1 100644 --- a/capsulflask/templates/support.html +++ b/capsulflask/templates/support.html @@ -7,7 +7,7 @@

SUPPORT

{% endblock %} @@ -17,7 +17,7 @@ https://lists.cyberia.club/~cyberia/support

- If you do not want your mail to appear in a public archive, email capsul@cyberia.club instead. + If you do not want your mail to appear in a public archive, email capsul@cyberia.club instead.

Please describe your problem or feature request, and we will do our best to get back to you promptly. Thank you very much. From c0d93d3db8c6cdf42b6aadd9452b3360ff9de72e Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 22 Oct 2020 14:34:26 -0500 Subject: [PATCH 3/9] Correct minor doc mistakes --- capsulflask/templates/faq.html | 39 ++++++++++++---------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/capsulflask/templates/faq.html b/capsulflask/templates/faq.html index 817e6ba..d6b7d04 100644 --- a/capsulflask/templates/faq.html +++ b/capsulflask/templates/faq.html @@ -12,25 +12,12 @@

  • Which instance type should I buy?

    There are no hard rules for this sort of thing, but here are some guidelines:

    -

    f1-xs

    -

    * blog

    -

    * vpn

    -

    * bot

    -

    * cgit

    -

    f1-s

    -

    * owncloud

    -

    * gitea

    -

    * popular blog/vpn/bot

    -

    f1-m

    -

    * docker host

    -

    * build system

    -

    f1-l

    -

    * large webservice with thousands of users

    -

    * rotund java app

    -

    f1-x

    -

    * gitlab (wow such devops very memory)

    -

    f1-xx

    -

    * something gigantic

    +

    f1-xs: blog, vpn, bot, cgit

    +

    f1-s: a bot, owncloud, gitea, popular blog

    +

    f1-m: docker host, build system

    +

    f1-l: large webservice, rotund java app

    +

    f1-x: gitlab (wow such memory very devops

    +

    f1-xx: something gargantuan

  • How do I log in? @@ -63,19 +50,19 @@ $ doas su -

    If you pay with a credit card, Stripe stores some additional details about you that we literally cannot delete.

  • - What can I do with my VM? + What can I do with my VM?

    Make it into a mailserver, a bitcoin miner, a VPN host, whatever you'd like.

    Our systems exist within the USA, and as such we are bound by US law.

  • - Can you recover my passwords/insert new keys? + Can you recover my passwords/insert new keys?

    Can we? Technically yes. Will we? No, never. It would violate the trust that our users have in us. - We have no interest in touching client VMs after they're running. - We promise to keep your machines running smoothly. - If you lose access to your VM, that's on you.

    + We have no interest in touching client VMs after they're running. + We promise to keep your machines running smoothly. + If you lose access to your VM, that's on you.

  • - Do you offer refunds? + Do you offer refunds?

    Not now, but email us and we can probably figure something out.

  • @@ -86,7 +73,7 @@ $ doas su -
  • Do you offer support? -

    Yep, see our support page

    . +

    Yep, see our support page.

  • Do you have an SLA? From f02974eb5abb5f9e7aa065be407798c64ffe6cb8 Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 22 Oct 2020 18:34:09 -0500 Subject: [PATCH 4/9] Simplify disk setup process --- capsulflask/shell_scripts/create.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/capsulflask/shell_scripts/create.sh b/capsulflask/shell_scripts/create.sh index dacee42..2a7760f 100755 --- a/capsulflask/shell_scripts/create.sh +++ b/capsulflask/shell_scripts/create.sh @@ -5,8 +5,7 @@ # POSIX or die vmname="$1" -# resolve the .qcow2 symlink so backing images never change -template_file="/tank/img/$(readlink /tank/img/$2)" +template_file="/tank/img/$2" vcpus="$3" memory="$4" pubkeys="$5" @@ -48,7 +47,7 @@ if [ -f /tank/vm/$vmname.qcow2 ]; then exit 1 fi -qemu-img create -f qcow2 -b "$template_file" "$disk" +cp "$template_file" "$disk" cp /tank/config/cyberia-cloudinit.yml /tmp/cloudinit.yml echo "$pubkeys" | while IFS= read -r line; do echo " - $line" >> /tmp/cloudinit.yml From cd92e8486d15820c3935ed58340893c599e70239 Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 29 Oct 2020 21:25:29 -0500 Subject: [PATCH 5/9] Add latest openbsd and alpine support --- capsulflask/db.py | 10 +++--- .../08_down_various_os_updates.sql | 31 +++++++++++++++++ .../08_up_various_os_updates.sql | 34 +++++++++++++++++++ 3 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 capsulflask/schema_migrations/08_down_various_os_updates.sql create mode 100644 capsulflask/schema_migrations/08_up_various_os_updates.sql diff --git a/capsulflask/db.py b/capsulflask/db.py index d2412bb..60cc103 100644 --- a/capsulflask/db.py +++ b/capsulflask/db.py @@ -14,7 +14,7 @@ def init_app(app): databaseUrl = urlparse(app.config['DATABASE_URL']) app.config['PSYCOPG2_CONNECTION_POOL'] = psycopg2.pool.SimpleConnectionPool( - 1, + 1, 20, user = databaseUrl.username, password = databaseUrl.password, @@ -34,13 +34,13 @@ def init_app(app): key = result.group() with open(join(schemaMigrationsPath, filename), 'rb') as file: schemaMigrations[key] = file.read().decode("utf8") - + connection = app.config['PSYCOPG2_CONNECTION_POOL'].getconn() hasSchemaVersionTable = False actionWasTaken = False schemaVersion = 0 - desiredSchemaVersion = 7 + desiredSchemaVersion = 8 cursor = connection.cursor() @@ -95,11 +95,11 @@ def init_app(app): if schemaVersion != versionFromDatabase: app.logger.critical("incorrect schema version value \"{}\" after running migration {}, expected \"{}\". exiting.".format( versionFromDatabase, - migrationKey, + migrationKey, schemaVersion )) exit(1) - + cursor.close() app.config['PSYCOPG2_CONNECTION_POOL'].putconn(connection) diff --git a/capsulflask/schema_migrations/08_down_various_os_updates.sql b/capsulflask/schema_migrations/08_down_various_os_updates.sql new file mode 100644 index 0000000..1c0af40 --- /dev/null +++ b/capsulflask/schema_migrations/08_down_various_os_updates.sql @@ -0,0 +1,31 @@ +DELETE FROM os_images WHERE id = 'openbsd68'; +DELETE FROM os_images WHERE id = 'alpine312'; + +UPDATE os_images SET deprecated = FALSE WHERE id = 'openbsd67'; +UPDATE os_images SET deprecated = FALSE WHERE id = 'alpine311'; + +UPDATE os_images SET template_image_file_name = 'ubuntu-18.04-minimal-cloudimg-amd64.img' +WHERE id = 'ubuntu18'; + +UPDATE os_images SET template_image_file_name = 'openbsd-cloud-2020-05.qcow2' +WHERE id = 'openbsd66'; + +UPDATE os_images SET template_image_file_name = 'openbsd67.img' +WHERE id = 'openbsd67'; + +UPDATE os_images SET template_image_file_name = 'ubuntu20.img' +WHERE id = 'ubuntu20'; + +UPDATE os_images SET template_image_file_name = 'debian10.img' +WHERE id = 'debian10'; + +UPDATE os_images SET template_image_file_name = 'centos7.img' +WHERE id = 'centos7'; + +UPDATE os_images SET template_image_file_name = 'centos8.img' +WHERE id = 'centos8'; + +UPDATE os_images SET template_image_file_name = 'guixsystem-cloud-2020-05.qcow2' +WHERE id = 'guix110'; + +UPDATE schemaversion SET version = 7; diff --git a/capsulflask/schema_migrations/08_up_various_os_updates.sql b/capsulflask/schema_migrations/08_up_various_os_updates.sql new file mode 100644 index 0000000..efe5104 --- /dev/null +++ b/capsulflask/schema_migrations/08_up_various_os_updates.sql @@ -0,0 +1,34 @@ +INSERT INTO os_images (id, template_image_file_name, description, deprecated) +VALUES ('openbsd68', 'openbsd/6.8/root.img.qcow2', 'OpenBSD 6.8', FALSE); + +INSERT INTO os_images (id, template_image_file_name, description, deprecated) +VALUES ('alpine312', 'alpine/3.12/root.img.qcow2', 'Alpine Linux 3.12', FALSE); + +UPDATE os_images SET deprecated = TRUE WHERE id = 'openbsd67'; +UPDATE os_images SET deprecated = TRUE WHERE id = 'alpine311'; + +UPDATE os_images SET template_image_file_name = 'ubuntu/18.04/root.img.qcow2' +WHERE id = 'ubuntu18'; + +UPDATE os_images SET template_image_file_name = 'openbsd/6.6/root.img.qcow2' +WHERE id = 'openbsd66'; + +UPDATE os_images SET template_image_file_name = 'openbsd/6.7/root.img.qcow2' +WHERE id = 'openbsd67'; + +UPDATE os_images SET template_image_file_name = 'ubuntu/20.04/root.img.qcow2' +WHERE id = 'ubuntu20'; + +UPDATE os_images SET template_image_file_name = 'debian/10/root.img.qcow2' +WHERE id = 'debian10'; + +UPDATE os_images SET template_image_file_name = 'centos/7/root.img.qcow2' +WHERE id = 'centos7'; + +UPDATE os_images SET template_image_file_name = 'centos/8/root.img.qcow2' +WHERE id = 'centos8'; + +UPDATE os_images SET template_image_file_name = 'guix/1.10/root.img.qcow2' +WHERE id = 'guix110'; + +UPDATE schemaversion SET version = 8; From 95f31b9cfafb810fff2e8b0f15491613e35bc3ae Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 29 Oct 2020 21:25:45 -0500 Subject: [PATCH 6/9] Allow / in template image filename --- capsulflask/virt_model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/capsulflask/virt_model.py b/capsulflask/virt_model.py index 2bf8d9a..8ff74cc 100644 --- a/capsulflask/virt_model.py +++ b/capsulflask/virt_model.py @@ -111,10 +111,10 @@ class ShellScriptVirtualization(VirtualizationInterface): def create(self, email: str, id: str, template_image_file_name: str, vcpus: int, memory_mb: int, ssh_public_keys: list): validate_capsul_id(id) - if not re.match(r"^[a-zA-Z0-9_.-]+$", template_image_file_name): - raise ValueError(f"template_image_file_name \"{template_image_file_name}\" must match \"^[a-zA-Z0-9_.-]+$\"") + if not re.match(r"^[a-zA-Z0-9/_.-]+$", template_image_file_name): + raise ValueError(f"template_image_file_name \"{template_image_file_name}\" must match \"^[a-zA-Z0-9/_.-]+$\"") - for ssh_public_key in ssh_public_keys: + for ssh_public_key in ssh_public_keys: if not re.match(r"^(ssh|ecdsa)-[0-9A-Za-z+/_=@. -]+$", ssh_public_key): raise ValueError(f"ssh_public_key \"{ssh_public_key}\" must match \"^(ssh|ecdsa)-[0-9A-Za-z+/_=@. -]+$\"") From 630f8926fd72a9ed7c4daf179c14cc12254e769e Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 29 Oct 2020 21:29:28 -0500 Subject: [PATCH 7/9] Issue small correction --- capsulflask/schema_migrations/08_down_various_os_updates.sql | 3 +++ capsulflask/schema_migrations/08_up_various_os_updates.sql | 3 +++ 2 files changed, 6 insertions(+) diff --git a/capsulflask/schema_migrations/08_down_various_os_updates.sql b/capsulflask/schema_migrations/08_down_various_os_updates.sql index 1c0af40..8de4d85 100644 --- a/capsulflask/schema_migrations/08_down_various_os_updates.sql +++ b/capsulflask/schema_migrations/08_down_various_os_updates.sql @@ -4,6 +4,9 @@ DELETE FROM os_images WHERE id = 'alpine312'; UPDATE os_images SET deprecated = FALSE WHERE id = 'openbsd67'; UPDATE os_images SET deprecated = FALSE WHERE id = 'alpine311'; +UPDATE os_images SET template_image_file_name = 'alpine311.img' +WHERE id = 'alpine311'; + UPDATE os_images SET template_image_file_name = 'ubuntu-18.04-minimal-cloudimg-amd64.img' WHERE id = 'ubuntu18'; diff --git a/capsulflask/schema_migrations/08_up_various_os_updates.sql b/capsulflask/schema_migrations/08_up_various_os_updates.sql index efe5104..6ccce04 100644 --- a/capsulflask/schema_migrations/08_up_various_os_updates.sql +++ b/capsulflask/schema_migrations/08_up_various_os_updates.sql @@ -7,6 +7,9 @@ VALUES ('alpine312', 'alpine/3.12/root.img.qcow2', 'Alpine Linux 3.12', FALSE); UPDATE os_images SET deprecated = TRUE WHERE id = 'openbsd67'; UPDATE os_images SET deprecated = TRUE WHERE id = 'alpine311'; +UPDATE os_images SET template_image_file_name = 'alpine/3.11/root.img.qcow2' +WHERE id = 'alpine311'; + UPDATE os_images SET template_image_file_name = 'ubuntu/18.04/root.img.qcow2' WHERE id = 'ubuntu18'; From 4906680e8824b18f9fa9643d383aad1291196983 Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 29 Oct 2020 21:33:01 -0500 Subject: [PATCH 8/9] Update changelog --- capsulflask/templates/changelog.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/capsulflask/templates/changelog.html b/capsulflask/templates/changelog.html index 3c0edcc..ab2e6e2 100644 --- a/capsulflask/templates/changelog.html +++ b/capsulflask/templates/changelog.html @@ -8,6 +8,9 @@ {% block subcontent %}

      +
    • 2020-10-29: Add OpenBSD 6.8 and Alpine 3.12 support, remove previous versions.
    • +
    • 2020-10-23: Automate VM build system (backend)
    • +
    • 2020-10-22: Re-worked FAQ, added more supporting docs
    • 2020-10-22: Re-worked FAQ, added more supporting docs
    • 2020-05-16: Beta version of new Capsul web application
    • 2020-05-04: Simplified payment page
    • From 7ae00c99401c8353e7e009b0f48ee474707b92bb Mon Sep 17 00:00:00 2001 From: j3s Date: Thu, 29 Oct 2020 21:34:39 -0500 Subject: [PATCH 9/9] * --- capsulflask/templates/changelog.html | 1 - 1 file changed, 1 deletion(-) diff --git a/capsulflask/templates/changelog.html b/capsulflask/templates/changelog.html index ab2e6e2..6615055 100644 --- a/capsulflask/templates/changelog.html +++ b/capsulflask/templates/changelog.html @@ -11,7 +11,6 @@
    • 2020-10-29: Add OpenBSD 6.8 and Alpine 3.12 support, remove previous versions.
    • 2020-10-23: Automate VM build system (backend)
    • 2020-10-22: Re-worked FAQ, added more supporting docs
    • -
    • 2020-10-22: Re-worked FAQ, added more supporting docs
    • 2020-05-16: Beta version of new Capsul web application
    • 2020-05-04: Simplified payment page
    • 2020-04-26: Support link added