Commit Graph

72 Commits

Author SHA1 Message Date
Ryan Petrello
6f43875e80 record profile data in /var/log/tower, not /var/lib/awx 2019-02-15 14:34:55 -05:00
Ryan Petrello
eed94b641e add a custom DB backend that provides system-level SQL profiling
run this command on _any_ node in an awx cluster:

$ awx-manage profile_sql --threshold=2.0 --minutes=1

...and for 1 minute, the timing for _every_ SQL query in _every_ awx
Python process that uses the Django ORM will be measured

queries that run longer than (in this example) 2 seconds will be
written to a per-process sqlite database in /var/lib/awx/profile, and
the file will contain an EXPLAIN VERBOSE for the query and the full
Python stack that led to that SQL query's execution (this includes not
just WSGI requests, but background processes like the runworker and
dispatcher)

$ awx-manage profile_sql --threshold=0

...can be used to disable profiling again (if you don't want to wait for
the minute to expire)
2019-02-14 15:04:46 -05:00
Ryan Petrello
daeeaf413a clean up unnecessary usage of the six library (awx only supports py3) 2019-01-25 00:19:48 -05:00
Ryan Petrello
c2660af60d stop various async background requests from bumping the session expiry
if a user has an active session that just sits on the dashboard or job
list, websocket messages that come in (for e.g., job status changes)
will trigger AJAX requests for more data; this process causes a user
with an idle login to continue to generate API requests, which in turn
ticks their expiry timer.  As a result, users with active sessions
sitting on these two (popular) pages will never be automatically logged
out via SESSION_MAX_AGE.

this change introduces a special header that the UI can use to signify
that a request shouldn't bump the expiry timer
2018-12-11 09:15:58 -05:00
Ryan Petrello
28512e042b remove DeprecatedAuthTokenMiddleware 2018-10-26 10:11:53 -04:00
Ryan Petrello
23d4122574 properly support deprecated Authorization: Token xyz 2018-09-24 14:50:33 -04:00
Ryan Petrello
4561fd7270 fix an auth-related typo in a docstring 2018-08-24 11:56:11 -04:00
Ryan Petrello
5561eb30f7 emulate /api/v2/authtoken/ to help customers transition to OAuth2.0 2018-08-24 11:05:41 -04:00
Ryan Petrello
a271837007 set the session cookie expiry *properly* on each request
see: https://github.com/ansible/tower/issues/2907
2018-08-22 15:26:03 -04:00
adamscmRH
762ce04b0a catch empty session case 2018-07-10 13:50:39 -04:00
adamscmRH
ae0793f374 Hookup UI session expiration 2018-07-03 16:53:27 -04:00
Ben Thomasson
0e32644a27 Check for missing environ in request 2018-03-23 17:00:27 -04:00
chris meyers
746a2c1eea short-circuit middleware if migration loading url
* Had to monkey patch django middleware logic.
* Left checks to tell coders to use new middleware behavior in favor of
monkey patching.
2018-03-02 11:21:26 -05:00
adamscmRH
310f37dd37 clears authtoken & add PAT 2018-02-22 15:18:12 -05:00
AlanCoding
9fb24f1a4c add hack to TimingMiddlWare for Shippable tests 2017-12-13 18:49:26 -05:00
Matthew Jones
9dbcc5934e Merge remote-tracking branch 'tower/release_3.2.2' into devel 2017-12-13 12:25:47 -05:00
AlanCoding
9ee18d02c8 new method of performance logging 2017-10-10 14:38:45 -04:00
Matthew Jones
b39db745d4 Integrate a migration-detector middleware
This attempts to detect if there are migrations in-progress and will
force display an interstitial page in the process that attempts to
load the index page every 10s until it succeeds.

This is only attached in production settings so the development
environment can proceed even if the migrations haven't been applied yet
2017-09-11 11:09:45 -04:00
Aaron Tan
c321819547 Handle named URL processing corner case where identifier is empty string 2017-08-22 10:40:45 -04:00
Aaron Tan
2ed3be0aab Add the ability to programmatically generate named URLs on client-side. 2017-06-14 10:37:40 -04:00
Aaron Tan
ceab33df80 Prevent generating named URL from non-existing endpoints. 2017-06-02 12:25:37 -04:00
Aaron Tan
f25391fe86 Implement named URL feature. 2017-05-31 12:09:54 -04:00
Ryan Petrello
e7c5dfeaa4 fix a bug which causes activitystream actor assignment to be invalid
Resolves #4660
2017-01-25 11:45:12 -05:00
AlanCoding
f3427d1359 Logging Integration, ELK docker-compose as update file 2016-11-29 13:09:47 -05:00
Aaron Tan
9e4655419e Fix flake8 E302 errors. 2016-11-15 20:59:39 -05:00
Chris Church
6ebe45b1bd Configure Tower in Tower:
* Add separate Django app for configuration: awx.conf.
* Migrate from existing main.TowerSettings model to conf.Setting.
* Add settings wrapper to allow get/set/del via django.conf.settings.
* Update existing references to tower_settings to use django.conf.settings.
* Add a settings registry to allow for each Django app to register configurable settings.
* Support setting validation and conversion using Django REST Framework fields.
* Add /api/v1/settings/ to display a list of setting categories.
* Add /api/v1/settings/<slug>/ to display all settings in a category as a single object.
* Allow PUT/PATCH to update setting singleton, DELETE to reset to defaults.
* Add "all" category to display all settings across categories.
* Add "changed" category to display only settings configured in the database.
* Support per-user settings via "user" category (/api/v1/settings/user/).
* Support defaults for user settings via "user-defaults" category (/api/v1/settings/user-defaults/).
* Update serializer metadata to support category, category_slug and placeholder on OPTIONS responses.
* Update serializer metadata to handle child fields of a list/dict.
* Hide raw data form in browsable API for OPTIONS and DELETE.
* Combine existing licensing code into single "TaskEnhancer" class.
* Move license helper functions from awx.api.license into awx.conf.license.
* Update /api/v1/config/ to read/verify/update license using TaskEnhancer and settings wrapper.
* Add support for caching settings accessed via settings wrapper.
* Invalidate cached settings when Setting model changes or is deleted.
* Preload all database settings into cache on first access via settings wrapper.
* Add support for read-only settings than can update their value depending on other settings.
* Use setting_changed signal whenever a setting changes.
* Register configurable authentication, jobs, system and ui settings.
* Register configurable LDAP, RADIUS and social auth settings.
* Add custom fields and validators for URL, LDAP, RADIUS and social auth settings.
* Rewrite existing validator for Credential ssh_private_key to support validating private keys, certs or combinations of both.
* Get all unit/functional tests working with above changes.
* Add "migrate_to_database_settings" command to determine settings to be migrated into the database and comment them out when set in Python settings files.
* Add support for migrating license key from file to database.
* Remove database-configuable settings from local_settings.py example files.
* Update setup role to no longer install files for database-configurable settings.

f 94ff6ee More settings work.
f af4c4e0 Even more db settings stuff.
f 96ea9c0 More settings, attempt at singleton serializer for settings.
f 937c760 More work on singleton/category views in API, add code to comment out settings in Python files, work on command to migrate settings to database.
f 425b0d3 Minor fixes for sprint demo.
f ea402a4 Add support for read-only settings, cleanup license engine, get license support working with DB settings.
f ec289e4 Rename migration, minor fixmes, update setup role.
f 603640b Rewrite key/cert validator, finish adding social auth fields, hook up signals for setting_changed, use None to imply a setting is not set.
f 67d1b5a Get functional/unit tests passing.
f 2919b62 Flake8 fixes.
f e62f421 Add redbaron to requirements, get file to database migration working (except for license).
f c564508 Add support for migrating license file.
f 982f767 Add support for regex in social map fields.
2016-09-26 22:14:47 -04:00
Matthew Jones
3de4aae548 Fixing up HA induced flake8 issues 2016-09-15 13:51:17 -04:00
Matthew Jones
0c1e1fa2fb Refactor Tower HA Instance logic and models
* Gut the HA middleware
* Purge concept of primary and secondary.
* UUID is not the primary host identifier, now it's based mostly on the
  username.  Some work probably still left to do to make sure this is
  legit.  Also removed unique constraint from the uuid field.  This
  might become the cluster ident now... or it may just deprecate
* No more secondary -> primary redirection
* Initial revision of /api/v1/ping
* Revise and gut tower-manage register_instance
* Rename awx/main/socket.py to awx/main/socket_queue.py to prevent
  conflict with the "socket" module from python base
* Revist/gut the Instance manager... not sure if this manager is really
  needed anymore
2016-09-08 13:37:53 -04:00
Matthew Jones
84c2e71907 Merge pull request #541 from matburt/database_config_source
Database config source
2016-01-12 11:20:43 -05:00
Matthew Jones
910f9bd4a3 Fixing up some flake8 issues 2015-12-17 10:48:15 -05:00
Matthew Jones
9db80bd9fc Support tower license within the database
With backwards support for the file-based license
2015-12-16 11:21:52 -05:00
Matthew Jones
dfd1ca4ae9 Relocate AUTH_TOKEN_* settings reference 2015-12-15 15:37:26 -05:00
Chris Meyers
fe9f502e91 flake8 fix 2015-12-04 10:49:04 -05:00
Matthew Jones
7ffbb2dac6 Don't save the instance in set_actor if the user is invalid 2015-11-18 07:27:52 -05:00
Matthew Jones
98965d4792 Fix typo in AnonymousUser 2015-11-17 12:46:50 -05:00
Matthew Jones
564f9e2c58 Fix an issue reauthing as a social auth user
If a social auth user is deleted and then attemnpts to relogin after the
old user object has been removed then it can cause an error.  So here
we'll add an extra lookup for the user just to verify
2015-11-17 12:42:33 -05:00
Chris Meyers
eb8219fd9f add Auth-Token-Timeout to http headers 2015-09-23 10:30:19 -04:00
John Mitchell
32d1c0e4db fixed copyright date 2015-06-11 16:10:23 -04:00
Matthew Jones
31d0342d41 More copyright headers for api side stuff 2015-05-29 12:10:40 -04:00
Matthew Jones
b3da3b34a3 Changing some legal headers for python source files 2015-05-29 12:10:39 -04:00
Matthew Jones
bb3732b2c1 Cleaning up some flake8 errors, pyflakes in this case 2015-02-10 17:00:23 -05:00
Chris Meyers
da63fc64d0 redirect to primary host with the original requesting path preserved 2015-01-21 13:53:46 -05:00
Luke Sneeringer
c02647cf04 Always allow the /ping/ endpoint, even on secondaries.
Also, if content is None, it does not have the keys we are checking for
in the ./configure script.
2014-12-17 13:09:58 -06:00
Luke Sneeringer
9dfa26fa58 Do not use ip_address on instances anymore. 2014-12-02 13:17:38 -06:00
Luke Sneeringer
bc763eab57 Know how to spot an HA environment. 2014-10-20 08:04:17 -05:00
Luke Sneeringer
1ae333ca1d HA redirection. 2014-10-20 08:04:16 -05:00
Luke Sneeringer
0e623f2337 Start of HA middleware. 2014-10-20 08:04:16 -05:00
Matthew Jones
99f2f65be2 Fix issue AC-1047, don't use pk when verifying that the user exists and isn't anonymous 2014-04-15 11:46:16 -04:00
Matthew Jones
a6a1a6504a Check for anonymous user in the activity stream middleware and don't
attempt to attach user information to the event
2014-02-21 11:09:03 -05:00
Chris Church
27fb54b2a7 AC-984 Prevent signal handlers from being run unnecessarily when deleting inventory, remove unnecessary extra queries, use update_fields when possible. 2014-01-27 18:37:51 -05:00