Commit Graph

114 Commits (442dd921a8b0f3304ba90763b64df67ebc5d791a)

Author SHA1 Message Date
Aravinth Manivannan 442dd921a8
debug: is dashboard accessible? 2022-06-26 04:19:02 +05:30
Aravinth Manivannan 4996e33cad
debug: is maildev accessible? 2022-06-26 04:19:02 +05:30
Aravinth Manivannan b3ffe8c739
fix: run only tests only once 2022-06-26 04:19:01 +05:30
Aravinth Manivannan 28fe03b861
fix: run wget in quiet mode and adapt MAILDEV_URL based on environment 2022-06-26 04:19:01 +05:30
Aravinth Manivannan fb5267a13b
hotfix: run gitea on host 2022-06-26 04:19:01 +05:30
Aravinth Manivannan f019039497
hot fix: disable gitea service 2022-06-26 04:19:01 +05:30
Aravinth Manivannan 3c33d10ca0
fix: mv test dependency services to woodpecker config file 2022-06-26 04:19:01 +05:30
Aravinth Manivannan da318beb58
chore: install docker-compose in CI 2022-06-26 04:19:01 +05:30
Aravinth Manivannan 997e772195
fix: woodpecker config file syntax 2022-06-26 04:19:01 +05:30
Aravinth Manivannan 798a2f03d9
feat: integration testing
SUMMARY
    integration/__main__.py is a CLI-based HTTP client that can interact
    with Hostea Dashboard and Gitea.

    Integration tests are run via integration/tests.sh, which is a
    driver for the HTTP client at integration/__main__.py. The script is
    capable of spinning up a test environment consisting of services
    defined in docker-compose-dev-deps.yml and the Hostea Dashboard and
    tearing it down after a successful run.

    The credentials used to create various accounts and other parameters
    are all defined in integration/tests.sh script it self. So it is
    self contained.

CLIENT FUNCTIONALITY:

    HOSTEA DASHBOARD:
	 - register user with email verification
	 - login
	 - create OIDC app
	 - visit support page

    GITEA:
	 - Install Gitea(DB configuration, etc. The first form that's
	 presented to the visitor after a new instance is deployed)
	 - Register User
	 - Login User
	 - Create repository
	 - Configure OIDC SSO
	 - Login via SSO
2022-06-26 04:19:01 +05:30
Aravinth Manivannan 3fb756bd12
feat: use local gitea instance for hostea support in dev 2022-06-26 04:19:01 +05:30
Aravinth Manivannan 2defc2d804
chore: run dependency services in test script via docker-compose-dev-deps 2022-06-26 04:19:01 +05:30
Aravinth Manivannan 08457c8bb2
feat: define dev env with smtp and gitea services 2022-06-26 04:19:01 +05:30
Aravinth Manivannan 4b20f9a439
feat: Dashboard-Gitea SSO integration test script
STEPS
    1. Register new user on dashboard

    2. Confirm user email, link is received from email. maildev/maildev
       is an SMTP server specifically built for testing emails locally.
       It comes with a REST API[0], which is used to access emails

    3. Sign in to Dashboard

    4. Visit /support/new/ on dashboard to raise new support request

    5. Redirection to Hostea Gitea support repository is done via
       JavaScript, so we simply test to see if the support repository's
       new issue page is present in the Dashboard response

    6. Go to support repository's new issue page. Gitea will redirect to
       sign in page

    7. Parse sign in page, find OIDC SSO link in sign in page

    8. Visit OIDC SSO link in sign in page, to be redirected to
       authorization page

    9. If OIDC integration on Dashboard is setup via `create_oidc`
       management command, then auto-authorization will be enabled for
       the integration. So user will be redirected to Gitea

    10. For new OIDC logins, Gitea will present a form to choose
	preferred username and enter email address. So fill that form
	and submit it.

	Please note the form submits to a different URL than the one at
	which the form is available. See `Gitea.__link_acount` and
	`Gitea.__link_acount_signup` and its usage in `Gitea._sso_login`

    11. Verify user creation by GET /{username}, should respond HTTP 200

    12. Visit new issue on support repository, should respond HTTP 200

RESOURCES
    [0]: https://github.com/maildev/maildev/blob/master/docs/rest.md
2022-06-26 04:19:01 +05:30
Aravinth Manivannan 4542389df8
fix: import vars defined in local_settings.py
ci/woodpecker/push/woodpecker Pipeline failed Details
fixes https://gitea.hostea.org/Hostea/dashboard/issues/5
2022-06-26 04:17:26 +05:30
Aravinth Manivannan 3378e61606
hotfix: use dashboard/local_settings.py instead of env vars
ci/woodpecker/pr/woodpecker Pipeline failed Details
ci/woodpecker/push/woodpecker Pipeline failed Details
My env var loading technique is not allowing local_settings.py to
override settings.py. This hotfix disables env vars in favor of
local_settings.py.

fixes https://gitea.hostea.org/Hostea/dashboard/issues/3
2022-06-26 01:49:32 +05:30
Aravinth Manivannan e7446dea2b Merge pull request 'allow overriding STRIPE_* with local_settings.py' (#2) from dachary/dashboard:wip-settings into master
ci/woodpecker/push/woodpecker Pipeline failed Details
Reviewed-on: https://gitea.hostea.org/Hostea/dashboard/pulls/2
2022-06-25 15:59:53 -04:00
Loïc Dachary adcdd00179
allow overriding STRIPE_* with local_settings.py
ci/woodpecker/pr/woodpecker Pipeline failed Details
Without a default value it will fail before it gets a chance to be
overriden by local_settings.py

Signed-off-by: Loïc Dachary <loic@dachary.org>
2022-06-25 21:29:04 +02:00
Aravinth Manivannan b387e44f49
feat: docs: local_settings.example.py
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-06-25 18:56:54 +05:30
Aravinth Manivannan 0d6968ff0a
feat: custom parameters template
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-06-25 18:42:42 +05:30
Aravinth Manivannan a39bcdb7b8
feat: disable i8ln as it's not implemented yet
> Django’s internationalization hooks are on by default, and that means
there’s a bit of i18n-related overhead in certain places of the
framework. If you don’t use internationalization, you should take the
two seconds to set USE_I18N = False in your settings file. Then Django
will make some optimizations so as not to load the internationalization
machinery. # Please enter the commit message for your changes. Lines
starting

ref: https://docs.djangoproject.com/en/4.0/topics/i18n/translation/
2022-06-25 18:42:41 +05:30
Aravinth Manivannan f0ee46e045 Merge pull request 'Backend integration' (#1) from wip-enough into master
ci/woodpecker/push/woodpecker Pipeline failed Details
Reviewed-on: https://gitea.hostea.org/Hostea/dashboard/pulls/1

Merge approval received on chat
2022-06-25 09:11:56 -04:00
Aravinth Manivannan 26b7ea3ef2
fix & rm: create/rm hostscripts, rm HOSTEA_DOMAIN
ci/woodpecker/push/woodpecker Pipeline failed Details
ci/woodpecker/pr/woodpecker Pipeline failed Details
2022-06-25 18:24:52 +05:30
Aravinth Manivannan 871a05ddd3
feat: payment check before creation and save gitea passwd in DB
ci/woodpecker/push/woodpecker Pipeline failed Details
ci/woodpecker/pr/woodpecker Pipeline failed Details
2022-06-25 18:03:04 +05:30
Aravinth Manivannan beb4b29c49
feat: pass template configuration, map VM sizes, generate secrets
return gitea passwd, git pull before writing and push after add/rm
2022-06-25 18:02:03 +05:30
Aravinth Manivannan 9af5361f63
feat: load local settings 2022-06-25 18:01:39 +05:30
Aravinth Manivannan 922d0c5f81
fix: don't create additional configuration opts 2022-06-25 18:01:08 +05:30
Aravinth Manivannan 94aad8e6ea
fix: templates: load user credentials and pass dynamic configuration.
Also escape curly braces
2022-06-25 18:00:13 +05:30
Aravinth Manivannan 80d6664f0d
feat: load VM domain from settings 2022-06-25 17:57:23 +05:30
Aravinth Manivannan ec49caa973
feat: payment status checking util 2022-06-25 16:27:43 +05:30
Aravinth Manivannan e688528fa3
fix: check payment status on instance level, used to be user level 2022-06-25 16:27:26 +05:30
Aravinth Manivannan 9f55a8ced7
feat: docs: hostea infrastructure config parameters
ci/woodpecker/push/woodpecker Pipeline failed Details
ci/woodpecker/pr/woodpecker Pipeline failed Details
2022-06-24 20:38:37 +05:30
Aravinth Manivannan f3324579c9
feat: utilities to add and remove VM on the Hostea repo 2022-06-24 20:35:32 +05:30
Aravinth Manivannan 1a234d402f
feat: init templates from enough docs[0]
[0]: https://enough-community.readthedocs.io/en/latest/services/hostea.html
2022-06-24 20:35:00 +05:30
Aravinth Manivannan ff8a21d9dc
feat: bootstrap infrastructure app with create_instance delete_instance
views
2022-06-24 20:34:11 +05:30
Aravinth Manivannan 04ec4037a9
feat: init gitpython and infrastructure app 2022-06-24 20:33:32 +05:30
Aravinth Manivannan 19ed720b82
feat: mv redirect if authenticated to decorator and guard other
ci/woodpecker/push/woodpecker Pipeline was successful Details
sigin/signup views
2022-06-22 00:43:10 +05:30
Aravinth Manivannan 96e71d7c32
fix: auto-redirect authenticated user when visiting login page 2022-06-22 00:43:10 +05:30
Aravinth Manivannan f6c89999e9
feat: test account verification email 2022-06-22 00:43:10 +05:30
Aravinth Manivannan 19682874ba
feat: payments system configuration docs
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-06-22 00:40:06 +05:30
Aravinth Manivannan d470033429
feat: implement billing with stripe
SUMMARY
    PAYMENT WORKFLOW
	1. User is redirected after a new instance is created into a view
	   that generates invoice. There are checks in place to ensure
	   invoices are not generated twice for the same VM. There is also a
	   check in place to generate invoices for time periods that are
	   already paid for
	2. User is redirected to payment form
	3. Stripe takes over
	4. If payment is successful, user is redirected to success page
	5. If payment failed, user is redirected to failure page

    PENDING INVOICES
	The user can see pending invoices on their dashboard

    PAYMENT RECEIPTS
	The user can see payment receipts on their dashboard
2022-06-22 00:37:03 +05:30
Aravinth Manivannan 760c0e90af
feat: create_instance_util test utility 2022-06-22 00:36:59 +05:30
Aravinth Manivannan 4908754b0d
feat: init billing app 2022-06-22 00:36:46 +05:30
Aravinth Manivannan 743f3447e7
feat: redirect to invoice after instance creation 2022-06-21 23:31:04 +05:30
Aravinth Manivannan bddd7a88b2
feat: link billing views in secondary nav bar 2022-06-21 23:30:20 +05:30
Aravinth Manivannan 8507129063
feat: create_oidc management command to create SSO integration for
ci/woodpecker/push/woodpecker Pipeline was successful Details
Hostea
2022-06-19 22:25:33 +05:30
Aravinth Manivannan cc1ecaf6a0
feat: init django-oauth-toolkit 2022-06-19 22:25:27 +05:30
Aravinth Manivannan a04cbf0943
feat: password strength validation during registration and migrate tests to cope with it
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-06-19 21:23:38 +05:30
Aravinth Manivannan faa7e924cc
feat: get_user_id management command
ci/woodpecker/push/woodpecker Pipeline was successful Details
DESCRIPTION
    Gets the DB assigned ID associated with a username
2022-06-19 21:02:38 +05:30
Aravinth Manivannan 38619babc7
feat: improve view VM styling and show VM configuration 2022-06-19 15:23:50 +05:30