Commit Graph

35 Commits

Author SHA1 Message Date
leigh-mil
812caf5d7d Update schema and create/update Environments domain methods to enforce environment name uniqueness within an application context. 2019-12-18 10:54:17 -05:00
leigh-mil
e5f83d2456 Update relationship between Environment and EnvironmentRole so only environment roles that are not deleted are included 2019-11-07 11:53:37 -05:00
richard-dds
e3c9105270 Fix some LGTM errors 2019-10-31 13:46:04 -04:00
leigh-mil
e64900245d Remove baseline_info column from environments table 2019-10-30 14:46:33 -04:00
richard-dds
2fca542100 Implement dispatch query for provision_user 2019-09-20 11:37:18 -04:00
dandds
82c34ee9b1 Display real environment processing status. 2019-09-18 16:34:56 -04:00
dandds
3a23c54723 Add a beat processing schedule for environment provisioning jobs.
The beat schedule is set to once per minute for each of the three
environment provisioning tasks.

Adding a beat schedule surfaced two problems that are addressed here
with the following changes:
- Commit the SQLALchemy session in order to release the environment
  lock. Otherwise the change to the `claimed_until` field is not
  persisted.
- Set `none_as_null` on the JSOB fields on the `Environment`. This
  avoids problems with querying on Postgres JSON fields that are empty.

This also adds a small change to the development command for the Celery
worker. Multiple child processes were executing the beat jobs, which
lead to exceptions for environment locks and confusing log output. This
contrains the dev command to a single Celery worker.
2019-09-18 16:34:56 -04:00
richard-dds
abeadee3f3 Claim resource only temporarily 2019-09-17 11:03:33 -04:00
richard-dds
030d67719b Remove unused imports 2019-09-16 16:52:54 -04:00
richard-dds
2bbe974755 Implement simple locking system for environments 2019-09-16 16:39:37 -04:00
richard-dds
365a50efce Add Environments.provisioning_status 2019-09-11 11:43:10 -04:00
richard-dds
f6cb6f2a31 Change Environment.creator relation from ApplicationRole to User 2019-09-11 11:42:59 -04:00
richard-dds
e65c1d69b6 Add Environment.creator_role relation 2019-09-11 11:42:40 -04:00
richard-dds
e9bf806dc6 Environment provisioning celery tasks
Failing test

Break env provisioning task into 3 separate tasks

Make env creation task idempotent

Test other env provisioning tasks

DRY tasks
2019-09-11 11:41:03 -04:00
dandds
7010bdb09c Record job failures with application context.
AT-AT needs to be able to track which user tasks failed and why. To
accomplish this we:

- Enabled Celery's results backend, which logs task results to a data
  store; a Postgres table, in our case.
  (https://docs.celeryproject.org/en/latest/userguide/tasks.html#result-backends)
- Created tables to track the relationships between the relevant models
  (Environment, EnvironmentRole) and their task failures.
- Added an `on_failure` hook that tasks can use. The hook will add
  records to the job failure tables.

Now a resource like an `Environment` has access to it task failures
through the corresponding failure table.

Notes:
- It might prove useful to use a real foreign key to the Celery results
  table eventually. I did not do it here because it requires that we
  explicitly store the Celery results table schema as a migration and
  add a model for it. In the current implementation, AT-AT can be
  agnostic about where the results live.
- We store the task results indefinitely, so it is important to specify
  tasks for which we do not care about the results (like `send_mail`)
  via the `ignore_result` kwarg.
2019-09-09 14:54:46 -04:00
dandds
df06d1b62f Use application_role_id on environment_roles.
In the future, an `application_invitation1 will not refer to a `user` until
someone accepts the invitation; they'll only reference an
`application_role`. When a user is invited to an application, the
inviter can specify the environments the invitee should have access to.
For this to be possible, an `environment_role` should reference an
`application_role`, because no `user` entity will be known at that time.

In addition to updating all the models and domain methods necessary for
this change, this commit deletes unused code and tests that were
dependent on `environment_roles` having a `user_id` foreign key.
2019-05-31 11:21:20 -04:00
leigh-mil
a1eb7ec935 Make sure all log events have portfolio and app ids (where applicable) 2019-05-22 13:08:44 -04:00
leigh-mil
addf2e97a1 Update form to nest all envs in one form 2019-05-14 10:58:22 -04:00
dandds
0bde431a70 extend soft delete functionality to app and env roles 2019-04-15 15:58:38 -04:00
dandds
0348af7ce7 record soft deletion in audit log for applications and environments 2019-04-15 15:58:38 -04:00
dandds
1c0c5dd9c5 soft deletes available for applications and environments
- parent relation will not include applications or environments marked
  as deleted
- domain classes will exclude deleted objects from selections
- changed some test factories to use domain_word for resource names,
  because they were using person names and it bugged me
2019-04-15 15:58:38 -04:00
dandds
372dac306f update workspace and project table names 2019-01-14 16:00:17 -05:00
dandds
48954ded11 update foreign key names; workspace_id -> portfolio_id, project_id -> application_id 2019-01-14 16:00:17 -05:00
dandds
d3d36822df workspace -> portfolio everywhere 2019-01-14 16:00:17 -05:00
dandds
3fc323d785 project -> application everywhere 2019-01-14 16:00:17 -05:00
Patrick Smith
2dba02e03c Add cloud_id column to environment model
When an environment is created, we'll need to create something in the
CSP and keep track of the ID of the created thing.
2019-01-07 17:30:34 -05:00
richard-dds
54aa10275f Check workspace permission, not ATAT permission 2018-11-29 10:37:20 -05:00
Patrick Smith
8bb9c1ab8a Add __repr__ to models 2018-10-02 14:14:39 -04:00
richard-dds
0aeca336b7 Add displayname to Project and Environment 2018-09-25 13:09:54 -04:00
richard-dds
004985057c auditable_workspace_id for Environment 2018-09-25 13:09:54 -04:00
richard-dds
ddc2e2fad7 Automatic audit logging using SQLA events 2018-09-25 13:09:54 -04:00
richard-dds
de338f675f Add lots of NOT NULL constraints 2018-09-21 14:00:01 -04:00
richard-dds
a69d6b2e1c Use Environment.num_users in projects template 2018-09-06 14:01:37 -04:00
richard-dds
3edbfa3129 Add and list environment members 2018-09-06 13:53:19 -04:00
richard-dds
8d58b2a7a0 WIP: created Project and Environment models 2018-08-21 20:21:10 -04:00