Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Demo mode #2523

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e5001e9
Demo mode
Matvey-Kuk Nov 18, 2024
31a3e88
Docs
Matvey-Kuk Nov 18, 2024
be886ff
Merge branch 'main' into Matvey-Kuk/demo_mode
Matvey-Kuk Nov 18, 2024
c682491
Fix
Matvey-Kuk Nov 18, 2024
c63e469
up
Matvey-Kuk Nov 18, 2024
7daf2ce
minor
Matvey-Kuk Nov 18, 2024
9b8c52b
fix
Matvey-Kuk Nov 18, 2024
5bc2ed9
Read or Create topology
Matvey-Kuk Nov 18, 2024
294a792
Fingerprint randomization
Matvey-Kuk Nov 18, 2024
d045a28
Merge branch 'main' into Matvey-Kuk/demo_mode
Matvey-Kuk Nov 18, 2024
42cbb09
conditional import
Matvey-Kuk Nov 18, 2024
b34c1df
Update keep/api/config.py
Matvey-Kuk Nov 18, 2024
ac3b392
Update docs/deployment/configuration.mdx
Matvey-Kuk Nov 18, 2024
fe22a75
Merge branch 'main' into Matvey-Kuk/demo_mode
Matvey-Kuk Nov 18, 2024
b8edba1
Fix
Matvey-Kuk Nov 18, 2024
a93fa0c
Merge remote-tracking branch 'refs/remotes/origin/Matvey-Kuk/demo_mod…
Matvey-Kuk Nov 18, 2024
ce121da
Up
Matvey-Kuk Nov 18, 2024
89faba0
More logs
Matvey-Kuk Nov 18, 2024
3fe4071
Waiting for API to get live
Matvey-Kuk Nov 18, 2024
0e329b2
when_ready
Matvey-Kuk Nov 19, 2024
d96465b
Fix
Matvey-Kuk Nov 19, 2024
0fe790d
fix: fix
talboren Nov 19, 2024
353e42c
fix: fix
talboren Nov 19, 2024
e333e9e
fix: fix
talboren Nov 19, 2024
2256347
wait for the connection
Matvey-Kuk Nov 19, 2024
baacc13
fix: fix
talboren Nov 19, 2024
c1dd51a
fix: fix
talboren Nov 19, 2024
1e83a5c
fix: timeout
talboren Nov 19, 2024
d11b44c
Providers
Matvey-Kuk Nov 19, 2024
bfdd576
customer_id:acme
Matvey-Kuk Nov 19, 2024
d3ece2a
Merge remote-tracking branch 'refs/remotes/origin/Matvey-Kuk/demo_mod…
Matvey-Kuk Nov 19, 2024
5ce3629
Fix provider reading
Matvey-Kuk Nov 20, 2024
ddcfcdf
Debug logs
Matvey-Kuk Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/deployment/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ General configuration variables control the core behavior of the Keep server. Th
| **KEEP_API_URL** | Specifies the Keep API URL | No | Constructed from HOST and PORT | Valid URL |
| **KEEP_STORE_RAW_ALERTS** | Enables storing of raw alerts | No | "false" | "true" or "false" |
| **TENANT_CONFIGURATION_RELOAD_TIME** | Time in minutes to reload tenant configurations | No | 5 | Positive integer |
| **KEEP_LIVE_DEMO_MODE** | Keep will simulate incoming alerts and other activity | No | "false" | "true" or "false" |

### Logging and Environment
<Info>
Expand Down
18 changes: 17 additions & 1 deletion keep/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
keep.api.logging.setup_logging()
logger = logging.getLogger(__name__)

LIVE_DEMO_MODE = os.environ.get("KEEP_LIVE_DEMO_MODE", "false").lower() == "true"


def on_starting(server=None):
"""This function is called by the gunicorn server when it starts"""
logger.info("Keep server starting")

migrate_db()
launch_uptime_reporting()

# Create single tenant if it doesn't exist
if AUTH_TYPE in [
Expand Down Expand Up @@ -54,4 +55,19 @@ def on_starting(server=None):
public_url = ngrok_connection.public_url
logger.info(f"ngrok tunnel: {public_url}")
os.environ["KEEP_API_URL"] = public_url

logger.info("Keep server started")


def when_ready(server):
"""This function is called by the gunicorn server when it is ready to accept requests"""
logger.info("Keep server ready")

launch_uptime_reporting()

if LIVE_DEMO_MODE:
logger.info("Launching Keep in demo mode.")
from keep.api.core.demo_mode_runner import launch_demo_mode
launch_demo_mode()
Matvey-Kuk marked this conversation as resolved.
Show resolved Hide resolved
else:
logger.info("Not launching Keep in demo mode.")
Loading
Loading