Commit Graph

325 Commits

Author SHA1 Message Date
j3s
d1c95cd113 Add ops 2021-08-16 02:21:52 +02:00
j3s
174532b7fe * 2021-08-16 02:21:52 +02:00
j3s
02c6352f11 Update support wording 2021-08-16 02:21:52 +02:00
171c3252e4 Merge pull request 'Add preliminary automated tests' (#1) from tests into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #1
2021-08-16 02:11:14 +02:00
3wc
13b2c05476 gitignore unittest output file
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-08-16 02:07:36 +02:00
5f9fc1adcf create TestHTTPClient that uses werkzueg test client, tests are passing 2021-08-16 02:07:36 +02:00
16ff1b5b26 documenting the janky tests logs situation 2021-08-16 02:07:36 +02:00
8c10f71f58 getting unit tests to log properly 2021-08-16 02:07:36 +02:00
66dee4d87a breaking up after abusive relationship with logger 2021-08-16 02:07:36 +02:00
6a587ac7fc trying to do CaptureLogOutputDuringTestsFilter (but no worky yet) 2021-08-16 02:07:36 +02:00
4e510ebb01 blah failed attempts at getting tests to log 2021-08-16 02:07:36 +02:00
140870ec35 add debug test log 2021-08-16 02:07:36 +02:00
2348191990 trying to get tests to pass with hub_model=capsulflask 2021-08-16 02:07:36 +02:00
5e682cc705 remove redundant get_vms() and add testing documentation from pull
request
2021-08-16 02:07:36 +02:00
3wc
2b33573890 Fix capsul create tests, post-test cleanup, tidy merge 2021-08-16 02:07:36 +02:00
da4d28f70c ensure that app is defined in app.py to fix login link logging issues.
also shuffled some things around for cleanliness
2021-08-16 02:07:36 +02:00
3wc
d833b3df19 Disable VM creation check for the moment 2021-08-16 02:07:36 +02:00
3wc
46a40261bb Add SSH key tests 2021-08-16 02:07:36 +02:00
3wc
b108d4c04e Initial console tests
NB capsul create isn't working properly, see #83
2021-08-16 02:07:36 +02:00
3wc
6bd02a660e Basic testing using flask-testing
This commit makes it possible to override settings during tests, by
switching capsulflask/__init__.py to a "create_app" pattern, and using
`dotenv_values` instead of `load_dotenv`.

The create_app() method returns a Flask app instance, to give
more control over when to initialise the app. This allows setting
environment variables in test files.

Then, use dotenv_values to override loaded .env variables with ones from
the environment, so that tests can set `POSTGRES_CONNECTION_PARAMETERS`
and `SPOKE_MODEL` (possibly others in future..).

Inital tests for the "landing" pages, and login / activation, are
included.
2021-08-16 02:07:34 +02:00
8a944104d3 Merge pull request 'Make the displayed SSH username configurable' (#12) from mirsal/capsul-flask:ssh-username into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #12
2021-08-10 11:56:14 +02:00
d4a9f2f40a Make the displayed SSH username configurable
Some checks failed
continuous-integration/drone/pr Build is failing
This patch allows the SSH username displayed in templates to be
configured through the SSH_USERNAME environment variable.
2021-08-10 00:30:45 +00:00
7b16606b16 Merge pull request 'shell_scripts: Fix reporting of VM IP addresses' (#9) from mirsal/capsul-flask:ipv6 into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #9
2021-08-04 12:13:44 +02:00
d9f3e68278 shell_scripts: Fix reporting of VM IP addresses
Some checks failed
continuous-integration/drone/pr Build is failing
The shell script which gets informations from libvirt incorrectly
matches virsh output lines which contain VMs' public IPv4 addresses.
It doesn't work when there are multiple address families which breaks
reporting of IPv4 address when a VM also has an IPv6 address and virsh
happen to output that one first.

This commit changes it to explicitely match the first ipv4 address instead.
2021-08-04 00:56:55 +00:00
72c04d8495 Docker image, & local development docker-compose.yml (#2)
All checks were successful
continuous-integration/drone/push Build is passing
Adds:
- a Docker image, which can be used in both development and production
- a `docker-compose.yml` file for local development (could probably be adapted for production deployments)

Testing:
- `git checkout docker`
- `docker-compose up`
- pray 🙏
- go to http://localhost:5000

## App architecture

I added the ability to load secret config variables (`HUB_TOKEN`, `STRIPE_SECRET_KEY` etc) from files, to support [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/) natively. The code should probably log an error if a specified `HUB_TOKEN_FILE` doesn't exist instead of failing silently..

## Docker architecture

This uses a multi-stage build to reduce the size of the final image -- having pipenv install to a predefined virtualenv, and then copying that over.

The compose file doesn't include a definition for a cron runner service, and I haven't tested running one yet. Here be dragons!

You can rebuild the image locally using `docker-compose build`, but this isn't required for changes to the app code, only if you edit the `Dockerfile`, or want to publish your image for use on a swarm server (in which case you will need to edit the image name to put in your own Docker hub credentials).

Currently, the image is rebuilt (should set up auto-tagging..) and published with every push to this 3wordchant/capsul-flask fork.

Reviewed-on: #2
Co-authored-by: 3wordchant <3wordchant@noreply.git.autonomic.zone>
Co-committed-by: 3wordchant <3wordchant@noreply.git.autonomic.zone>
2021-07-22 01:18:10 +02:00
5bb76173dd Add custom themes, THEME setting, basic "yolocolo" theme (#7)
Specify `THEME=yourtheme`, add some HTML files in `capsulflask/theme/yourtheme` 👌

We probably want to reduce copypasta in the current `yolocolo` theme by using template inheritance, at some point.

Reviewed-on: #7
Co-authored-by: 3wordchant <3wordchant@noreply.git.autonomic.zone>
Co-committed-by: 3wordchant <3wordchant@noreply.git.autonomic.zone>
2021-07-22 01:15:39 +02:00
8c0c613392 Merge remote-tracking branch 'threewordchant/master' 2021-07-21 16:47:46 -05:00
50ee1144f9 Merge remote-tracking branch 'threewordchant/master' 2021-07-21 16:46:50 -05:00
3wc
c4ba5ea197 Merge branch 'master' of ssh://git.autonomic.zone:2222/3wordchant/capsul-flask 2021-07-21 23:46:37 +02:00
08eb38dc57 correctly enforce affordable_vm_sizes post form submission 2021-07-21 16:45:53 -05:00
3wc
33f4551cf4 Merge branch 'docs-reshuffle' 2021-07-21 23:44:42 +02:00
3wc
0fa7fb28b5 Split README up into separate files, plus:
* forest's ReadMe docs changes
* add Configuration-type-stuff that lives in the database
2021-07-21 23:43:44 +02:00
be6e72028c define BTCPAY_ENABLED based on URL and btcpay key, pass it explicitly 2021-07-21 23:43:44 +02:00
3wc
bf7487f4f0 Don't load /btcpay if BTCPAY_PRIVATE_KEY un-set 2021-07-21 23:43:44 +02:00
3wc
8b0ce0ba71 Hide the BTCPay link if BTCPAY_PRIVATE_KEY un-set 2021-07-21 23:43:44 +02:00
3wc
bca570882e Add load_config_vars context processor..
..to allow accessing config variables in the templates.

This removes the need for adding config variables manually to template
contexts.
2021-07-21 23:43:44 +02:00
f3ae9aae23 remove class="small" from pricing table cuz normal size fits fine 2021-07-21 23:43:44 +02:00
3wc
827ca4a50b Auto-generate the pricing table from the database 2021-07-21 23:43:44 +02:00
f999adaf71 Add VMs to the database even with HUB_MODE=mock (#6)
https://todo.cyberia.club/~cyberia/services/83

Co-authored-by: 3wc <3wc.cyberia@doesthisthing.work>
Co-authored-by: forest <forest.n.johnson@gmail.com>
Reviewed-on: #6
Co-authored-by: 3wordchant <3wordchant@noreply.git.autonomic.zone>
Co-committed-by: 3wordchant <3wordchant@noreply.git.autonomic.zone>
2021-07-21 23:26:10 +02:00
3wc
8f2becb9ee Fix SyntaxWarning on is not ""
`capsulflask/__init__.py:143: SyntaxWarning: "is not" with a literal. Did you mean "!="?`
2021-07-21 21:51:50 +02:00
f848eda931 Merge pull request 'Disable BTCPay in the interface, if BTCPAY_PRIVATE_KEY is un-set' (#3) from optional-btcpay into master
Reviewed-on: #3
2021-07-21 20:20:40 +02:00
46f49e8d8f Merge pull request 'Auto-generate the pricing table from the database' (#4) from generated-prices into master
Reviewed-on: #4
2021-07-21 19:32:09 +02:00
36329796f0 define BTCPAY_ENABLED based on URL and btcpay key, pass it explicitly 2021-07-21 12:12:41 -05:00
28271ee852 remove class="small" from pricing table cuz normal size fits fine 2021-07-21 11:53:44 -05:00
3wc
7923f3a99f Auto-generate the pricing table from the database 2021-07-21 12:19:28 +02:00
3wc
7ed847251f Don't load /btcpay if BTCPAY_PRIVATE_KEY un-set 2021-07-21 00:22:58 +02:00
3wc
e3a4776a5d Hide the BTCPay link if BTCPAY_PRIVATE_KEY un-set 2021-07-21 00:20:38 +02:00
3wc
357d99cb91 Add load_config_vars context processor..
..to allow accessing config variables in the templates.

This removes the need for adding config variables manually to template
contexts.
2021-07-21 00:19:38 +02:00
b8279d7491 add about ssh link to faq 2021-07-19 18:09:02 -05:00
908d02803f move hardcoding public3 to the right place 2021-07-12 16:10:28 -05:00