Commit Graph

315 Commits

Author SHA1 Message Date
forest 6d52f56d27 documenting the janky tests logs situation
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is failing Details
2021-07-27 14:49:10 -05:00
forest f5640a1d01 getting unit tests to log properly
continuous-integration/drone/push Build is passing Details
2021-07-27 14:44:10 -05:00
forest 45d7e2c62e breaking up after abusive relationship with logger 2021-07-27 14:28:42 -05:00
forest 56b00934be trying to do CaptureLogOutputDuringTestsFilter (but no worky yet)
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is passing Details
2021-07-27 13:56:58 -05:00
forest aa67a1e1b2 blah failed attempts at getting tests to log 2021-07-27 13:28:49 -05:00
forest 3fb8254c15 add debug test log
continuous-integration/drone/push Build is passing Details
2021-07-27 12:50:50 -05:00
forest 8a4794a344 trying to get tests to pass with hub_model=capsulflask
continuous-integration/drone/push Build is passing Details
2021-07-27 12:48:48 -05:00
forest 4cf11798aa remove redundant get_vms() and add testing documentation from pull
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is passing Details
request
2021-07-27 12:02:48 -05:00
3wc e1867eb430 Fix capsul create tests, post-test cleanup, tidy merge
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is passing Details
2021-07-23 13:40:00 +02:00
forest 62c7355b4c ensure that app is defined in app.py to fix login link logging issues.
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is passing Details
also shuffled some things around for cleanliness
2021-07-23 03:02:17 +02:00
3wc 202d0aefff Disable VM creation check for the moment 2021-07-23 03:02:17 +02:00
3wc 01478dfd87 Add SSH key tests 2021-07-23 03:02:17 +02:00
3wc a4837aff87 Initial console tests
NB capsul create isn't working properly, see #83
2021-07-23 03:02:17 +02:00
3wc ecc8f885fa 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-07-23 03:02:15 +02:00
3wordchant 72c04d8495 Docker image, & local development docker-compose.yml (#2)
continuous-integration/drone/push Build is passing Details
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
3wordchant 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
forest 8c0c613392 Merge remote-tracking branch 'threewordchant/master' 2021-07-21 16:47:46 -05:00
forest 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
forest 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
forest 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
forest 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
3wordchant 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
3wordchant 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
3wordchant 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
forest 36329796f0 define BTCPAY_ENABLED based on URL and btcpay key, pass it explicitly 2021-07-21 12:12:41 -05:00
forest 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
forest b8279d7491 add about ssh link to faq 2021-07-19 18:09:02 -05:00
forest 908d02803f move hardcoding public3 to the right place 2021-07-12 16:10:28 -05:00
forest 6e6bd2b143 fix syntax error 2021-07-12 16:00:37 -05:00
forest 47fbaab403 hardcode network_name=public3 to sidestep phantom dhcp lease issues 2021-07-12 15:59:20 -05:00
forest 06a2bd3a6f add public_ipv4_first_usable_ip, public_ipv4_last_usable_ip 2021-07-12 14:38:56 -05:00
forest fbe9c7fca4 fix last IP address hanging off the end of the display on admin page 2021-07-12 12:27:07 -05:00
forest 6bdb133153 make admin display work better on phones 2021-07-12 12:23:27 -05:00
forest b459e56f3a use the provided network_name when creating a capsul 2021-07-12 12:19:56 -05:00
forest be54117736 migration 17: network_name -> virtual_bridge_name, add network_name col 2021-07-12 12:16:32 -05:00
forest aaf33a245b point capsul at new public3/virbr3 network 2021-07-12 11:29:37 -05:00
forest ad9c3476c7 simplify cidr block logic a little bit 2021-07-12 11:29:33 -05:00
forest fcbea1e29b fixing capsul creation after I broke it with the pre-allocated IP
address changes
2021-07-11 12:18:58 -05:00