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..8de4d85 --- /dev/null +++ b/capsulflask/schema_migrations/08_down_various_os_updates.sql @@ -0,0 +1,34 @@ +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 = 'alpine311.img' +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..6ccce04 --- /dev/null +++ b/capsulflask/schema_migrations/08_up_various_os_updates.sql @@ -0,0 +1,37 @@ +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 = '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'; + +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; 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 diff --git a/capsulflask/templates/changelog.html b/capsulflask/templates/changelog.html index 685bc5d..6615055 100644 --- a/capsulflask/templates/changelog.html +++ b/capsulflask/templates/changelog.html @@ -8,18 +8,21 @@ {% block subcontent %}
There are no hard rules for this sort of thing, but here are some guidelines:
+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
ssh to the ip provided to you using the cyberian user.
-$ ssh cyberian@1.2.3.4-
ssh to the ip provided to you using the cyberian user.
+$ ssh cyberian@1.2.3.4
The cyberian user has passwordless sudo access by default. This should work:
# Linux @@ -77,74 +33,55 @@ $ sudo su - # OpenBSD $ doas su --
We do, but right now it's a manual process. Shoot us an email and we'll get it done.
-Your VM will be deleted. You will receive coal. - You will be banned from our minetest server. - We will attempt to give you ample warning before nuking a server, but that's no guarantee. -
-Your VM will eventually be deleted. + Capsul will send you a few inoffensive reminders as that termination date approaches. +
We associate an email address with every VM so that we can track payment and respond to support requests.
-If you pay with a credit card, Stripe sends some additional details about you that we literally cannot delete.
-If you pay with a credit card, Stripe stores some additional details about you that we literally cannot delete.
Make it into a mailserver, a bitcoin miner, a VPN host, whatever.
-We place no restrictions on what you can do, as long as it's not illegal. Don't get us in trouble.
-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 we? Technically yes. Will we? Never. It would violate the trust that our customers have in us. - We have no interest in touching client VMs after they're running. - If you lose access to your VM, that's on you.
-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.
Not now.
-Not now, but email us and we can probably figure something out.
Capsul runs on a server named Baikal which Cyberia built from scratch & mailed to a datacenter in Georgia called CyberWurx. CyberWurx staff installed it for us in a rack space that Cyberia pays for.
-Yep, email us at support@cyberia.club
-Yep, see our support page.
+No, but we normally respond pretty quickly.
Maybe! Email ops@cyberia.club and ask us about it.
- 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. 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+/_=@. -]+$\"")