diff --git a/CHANGELOG.md b/CHANGELOG.md index 869ce768..ad6ed4f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,13 @@ All notable changes to this project will be documented in this file. ## v1.24.0 - Unreleased ### Improvements -- Switch from croniter to cronsim (vendored in hc.lib.cronsim) +- Switch from croniter to cronsim - Change outgoing webhook timeout to 10s, but cap the total time to 20s - Implement automatic `api_ping` and `api_notification` pruning (#556) - Update Dockerfile to install apprise (#581) - Improve period and grace controls, allow up to 365 day periods (#281) - Add SIGTERM handling in sendalerts and sendreports +- Remove the "welcome" landing page, direct users to the sign in form instead ### Bug Fixes - Fix hc.api.views.ping to handle non-utf8 data in request body (#574) diff --git a/hc/accounts/tests/test_close_account.py b/hc/accounts/tests/test_close_account.py index 3306f068..d8c01455 100644 --- a/hc/accounts/tests/test_close_account.py +++ b/hc/accounts/tests/test_close_account.py @@ -34,7 +34,7 @@ class CloseAccountTestCase(BaseTestCase): payload = {"confirmation": "alice@example.org"} r = self.client.post("/accounts/close/", payload) - self.assertRedirects(r, "/") + self.assertRedirects(r, "/accounts/login/") # Alice should be gone alices = User.objects.filter(username="alice") @@ -68,7 +68,7 @@ class CloseAccountTestCase(BaseTestCase): payload = {"confirmation": "bob@example.org"} r = self.client.post("/accounts/close/", payload) - self.assertRedirects(r, "/") + self.assertRedirects(r, "/accounts/login/") # Alice should be still present self.alice.refresh_from_db() diff --git a/hc/accounts/views.py b/hc/accounts/views.py index 35f1b493..fbc61e60 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -631,7 +631,7 @@ def close(request): user.delete() request.session.flush() - return redirect("hc-index") + return redirect("hc-login") ctx = {} if "confirmation" in request.POST: diff --git a/hc/front/tests/test_basics.py b/hc/front/tests/test_basics.py index c1d20f74..9cf95ae2 100644 --- a/hc/front/tests/test_basics.py +++ b/hc/front/tests/test_basics.py @@ -4,24 +4,29 @@ from django.test.utils import override_settings class BasicsTestCase(TestCase): @override_settings(DEBUG=False, SECRET_KEY="abc") - def test_it_shows_welcome(self): + def test_it_redirects_to_login(self): r = self.client.get("/") - self.assertContains(r, "Get Notified", status_code=200) + self.assertRedirects(r, "/accounts/login/") + + @override_settings(DEBUG=False, SECRET_KEY="abc") + def test_it_shows_no_warning(self): + r = self.client.get("/accounts/login/") + self.assertContains(r, "Sign In to", status_code=200) self.assertNotContains(r, "do not use in production") @override_settings(DEBUG=True, SECRET_KEY="abc") def test_it_shows_debug_warning(self): - r = self.client.get("/") + r = self.client.get("/accounts/login/") self.assertContains(r, "Running in debug mode") @override_settings(DEBUG=False, SECRET_KEY="---") def test_it_shows_secret_key_warning(self): - r = self.client.get("/") - self.assertContains(r, "Get Notified", status_code=200) + r = self.client.get("/accounts/login/") + self.assertContains(r, "Sign In to", status_code=200) self.assertContains(r, "Running with an insecure SECRET_KEY value") @override_settings(REGISTRATION_OPEN=False) def test_it_obeys_registration_open(self): - r = self.client.get("/") + r = self.client.get("/accounts/login/") - self.assertNotContains(r, "Get Started") + self.assertNotContains(r, "Sign Up") diff --git a/hc/front/views.py b/hc/front/views.py index 019b1227..d58bc619 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -310,42 +310,7 @@ def index(request): return render(request, "front/projects.html", ctx) - check = Check() - - ctx = { - "page": "welcome", - "check": check, - "ping_url": check.url(), - "enable_apprise": settings.APPRISE_ENABLED is True, - "enable_call": settings.TWILIO_AUTH is not None, - "enable_discord": settings.DISCORD_CLIENT_ID is not None, - "enable_linenotify": settings.LINENOTIFY_CLIENT_ID is not None, - "enable_matrix": settings.MATRIX_ACCESS_TOKEN is not None, - "enable_mattermost": settings.MATTERMOST_ENABLED is True, - "enable_msteams": settings.MSTEAMS_ENABLED is True, - "enable_opsgenie": settings.OPSGENIE_ENABLED is True, - "enable_pagertree": settings.PAGERTREE_ENABLED is True, - "enable_pd": settings.PD_ENABLED is True, - "enable_pd_simple": settings.PD_APP_ID is not None, - "enable_prometheus": settings.PROMETHEUS_ENABLED is True, - "enable_pushbullet": settings.PUSHBULLET_CLIENT_ID is not None, - "enable_pushover": settings.PUSHOVER_API_TOKEN is not None, - "enable_shell": settings.SHELL_ENABLED is True, - "enable_signal": settings.SIGNAL_CLI_ENABLED is True, - "enable_slack": settings.SLACK_ENABLED is True, - "enable_slack_btn": settings.SLACK_CLIENT_ID is not None, - "enable_sms": settings.TWILIO_AUTH is not None, - "enable_spike": settings.SPIKE_ENABLED is True, - "enable_telegram": settings.TELEGRAM_TOKEN is not None, - "enable_trello": settings.TRELLO_APP_KEY is not None, - "enable_victorops": settings.VICTOROPS_ENABLED is True, - "enable_webhooks": settings.WEBHOOKS_ENABLED is True, - "enable_whatsapp": settings.TWILIO_USE_WHATSAPP, - "enable_zulip": settings.ZULIP_ENABLED is True, - "registration_open": settings.REGISTRATION_OPEN, - } - - return render(request, "front/welcome.html", ctx) + return redirect("hc-login") def dashboard(request): diff --git a/static/css/signup.css b/static/css/signup.css new file mode 100644 index 00000000..cf85d128 --- /dev/null +++ b/static/css/signup.css @@ -0,0 +1,28 @@ +#signup-modal .modal-header { + border-bottom: 0; +} + +#signup-modal .modal-body { + padding: 0 50px 50px 50px; +} + +#signup-modal div.title { + font-size: 30px; + text-align: center; + margin: 0 0 50px 0; +} + +#signup-modal label { + font-weight: normal; +} + +#signup-modal #link-instruction { + text-align: center; +} + +#signup-result { + margin-top: 20px; + text-align: center; + font-size: 18px; + display: none; +} \ No newline at end of file diff --git a/static/css/welcome.css b/static/css/welcome.css deleted file mode 100644 index a312123d..00000000 --- a/static/css/welcome.css +++ /dev/null @@ -1,189 +0,0 @@ -.page-welcome .navbar { - margin-bottom: 0; -} - -.index-bleed { - padding-bottom: 2em; -} - -.get-started-bleed { - background: var(--get-started-bg); - padding: 3em 0; -} - -.footer-jumbo-bleed { - background: #eee; -} - - -#pitch { - text-align: center; - padding: 100px 0; - margin: 0; - font-size: 36px; - font-weight: bold; -} - -#pitch small { - display: block; - margin-top: 10px; - font-size: 18px; - color: #333; -} - -#pitch-subtitle { - font-size: 14px; - margin-top: 0; - text-align: center; -} - -#pitch-url { - text-align: center; - font-family: monospace; - margin: 10px auto; -} - -#pitch-url code { - color: var(--text-color); - background: var(--pre-bg); - display: inline-block; - margin-top: 0px; - padding: 6px 9px; -} - -#pitch-text { - margin: 0 auto 72px auto; -} - -.nav-tabs { - margin-bottom: 0; -} - -#get-started h1 { - font-size: 20px; - line-height: 1.5; - margin: 0 0 20px 0; -} - -.tour-title { - margin: 50px 0; -} - - -.tour-section { - margin-bottom: 80px; -} - -.tour-section h3 { - margin-top: 10px; - font-weight: bold; -} - -#welcome-integrations { - margin-bottom: 80px; -} - -#welcome-integrations h2 { - font-size: 24px; - text-align: center; - margin-bottom: 20px; -} - -#welcome-integrations h2 small { - font-size: 14px; -} - -#welcome-integrations .integration { - display: block; - color: var(--text-color); - border: 1px solid var(--border-color); - border-radius: 3px; - padding: 20px 0; - text-align: center; - margin-bottom: 30px; - text-decoration: none; -} - -#welcome-integrations a.integration:hover { - border-color: #0091EA; - text-decoration: none; -} - -#welcome-integrations img { - width: 48px; - height: 48px; -} - -#welcome-integrations p { - font-size: 18px; - margin: 20px 0 0 0; - line-height: 1.1; -} - -#welcome-integrations p small { - font-size: 12px; - color: #777777; -} - -.use-cases li { - line-height: 200%; -} - -.page-welcome .tab-content { - border: 1px solid var(--border-color); - border-top: 0; -} - -#email.tab-pane { - padding: 20px; - margin: 0; -} - -.page-welcome .highlight:nth-child(n+2) { - border-top: 1px solid var(--border-color); -} - -.page-welcome .tab-pane pre { - margin-bottom: 0; - background: transparent; - padding: 15px; -} - -.tab-pane.tab-pane-email { - border: none; -} - -#signup-modal .modal-header { - border-bottom: 0; -} - -#signup-modal .modal-body { - padding: 0 50px 50px 50px; -} - -#signup-modal div.title { - font-size: 30px; - text-align: center; - margin: 0 0 50px 0; -} - -#signup-modal label { - font-weight: normal; -} - -#signup-modal #link-instruction { - text-align: center; -} - -#signup-result { - margin-top: 20px; - text-align: center; - font-size: 18px; - display: none; -} - -#footer-cta p { - max-width: 800px; - margin-left: auto; - margin-right: auto; -} diff --git a/templates/base.html b/templates/base.html index aa791786..0d59ec76 100644 --- a/templates/base.html +++ b/templates/base.html @@ -56,9 +56,9 @@ - + {% endcompress %} diff --git a/templates/front/welcome.html b/templates/front/welcome.html deleted file mode 100644 index 3d91164c..00000000 --- a/templates/front/welcome.html +++ /dev/null @@ -1,787 +0,0 @@ -{% extends "base.html" %} -{% load compress hc_extras i18n static %} - -{% block description %} - -{% endblock %} - - -{% block head %} - -{% endblock %} - -{% block containers %} -
-
-
-
-

- {% trans "Monitoring for your nightly backups, weekly reports, cron jobs and background tasks." %} -

-
-
- -
-
-

- {% trans "Make HTTP requests to the Ping URL at regular intervals." %} - - {% blocktrans trimmed %} - When the URL is not pinged on time, - {{ site_name }} will send you an alert. - {% endblocktrans %} - - - {% trans "You can monitor any service that can make HTTP requests or send emails." %} -

-
-
-

- {% blocktrans trimmed %} - For each of your periodic tasks, - {{ site_name }} provides an unique URL similar to this one: - {% endblocktrans %} -

-
- {{ ping_url }} -
-
-
- -
-
- -
-
- {% include "front/snippets/crontab.html" %} -
-
- {% include "front/snippets/bash_curl.html" %} - {% include "front/snippets/bash_wget.html" %} -
-
- {% include "front/snippets/python_urllib2.html" %} - {% include "front/snippets/python_requests.html" %} -
-
- {% include "front/snippets/ruby.html" %} -
-
- {% include "front/snippets/node.html" %} -
-
- {% include "front/snippets/go.html" %} -
-
- {% include "front/snippets/php.html" %} -
-
- {% include "front/snippets/cs.html" %} -
-
- {% include "front/snippets/browser.html" %} -
-
- {% include "front/snippets/powershell.html" %} - {% include "front/snippets/powershell_inline.html" %} -
-
-

- {% blocktrans trimmed %} - As an alternative to HTTP requests, - you can also report "liveness" by - sending email messages. - {% endblocktrans %} -

-

- {% blocktrans trimmed %} - You can instruct {{ site_name }} to look for a particular - keyword in the subject line. This is handy when your backup - software sends an email after every run, and uses a different - subject line depending on success or failure. - {% endblocktrans %} -

-
-
-
-
-
-
- -{% if registration_open %} -
-
-
-
-

- {% blocktrans trimmed %} - {{ site_name }} monitors the heartbeat messages sent by your cron - jobs, services and APIs. Get immediate alerts when they don't - arrive on schedule. - {% endblocktrans %} -

- - {% trans "Sign Up – It's Free" %} - -
-
-
-
-{% endif %} - -
-
-
-

- {% trans "A quick peek of what's inside:" %} -

-
-
- -
-
- My Checks page -
-
-

- {% trans "Live-updating Dashboard" %} -

-

- {% blocktrans trimmed %} - A list of your checks, one for each Cron job, daemon or - scheduled task you want to monitor. - {% endblocktrans %} -

-

- {% blocktrans trimmed %} - Give names and assign tags to your checks to easily recognize - them later. - {% endblocktrans %} -

-

- {% blocktrans trimmed %} - Tap on the integration icons to toggle them on and off. - {% endblocktrans %} -

-

- {% blocktrans trimmed %} - Adjust Period and Grace time to match the - periodicity and duration of your tasks. - {% endblocktrans %} -

-
-
- -
-
- Period/Grace Time dialog -
-
-

{% trans "Simple Configuration" %}

- {% blocktrans trimmed %} - Each check has configurable Period and Grace Time parameters. - Depending on these parameters and time since the last ping, the check is in one of the - following states: - {% endblocktrans %} - - - - - - - - - - - - - - - - - - -
- - - {% blocktrans trimmed %} - New. - A check that has been created, but has not received any pings yet. - {% endblocktrans %} -
- - - {% blocktrans trimmed %} - Up. - The time since the last ping has not exceeded Period. - {% endblocktrans %} -
- - - {% blocktrans trimmed %} - Late. - The time since the last ping has exceeded Period, - but has not yet exceeded Period + Grace. - {% endblocktrans %} -
- - - {% blocktrans trimmed %} - Down. - The time since the last ping has exceeded Period + Grace. - When a check goes from "Late" to "Down", {{ site_name }} - sends you a notification. - {% endblocktrans %} -
- -
-
- -
-
- Cron dialog -
-
-

{% trans "Cron Expression Support" %}

-

- {% blocktrans trimmed %} - Alternatively, you can define the expected ping dates and times - using a cron expression. See - {% endblocktrans %} - - {% trans "Cron Syntax Cheatsheet" %} - - {% blocktrans trimmed %} - for the supported syntax features. - {% endblocktrans %} -

-

- {% blocktrans trimmed %} - Grace Time specifies how "late" a ping can - be before you are alerted. You should set it to be a little above - the expected duration of your cron job. - {% endblocktrans %} -

-
-
- -
-
- Details Page -
-
-

{% trans "Details and Event Log" %}

-

- {% blocktrans trimmed %} - You can add a longer, free-form description to each - check. Leave notes and pointers for yourself and - your team. - {% endblocktrans %} -

-

- {% blocktrans trimmed %} - You can also see the log of received pings and - sent "Down" notifications. - {% endblocktrans %} -

-
-
- -
-
- Details Page -
-
-

{% trans "Public Status Badges" %}

-

- {% blocktrans trimmed %} - {{ site_name }} provides status badges for each of the tags - you have used. Additionally, the "{{ site_name }}" badge - shows the overall status of all checks in your account. - {% endblocktrans %} -

-

- {% blocktrans trimmed %} - The badges have public but hard-to-guess URLs. - You can use them in your READMEs, dashboards, or status pages. - {% endblocktrans %} -

-
-
- -
-
-

{% trans "Integrations" %}
- - {% trans "Set up multiple ways to get notified:" %} - -

-
-
-
- -

- {% trans "Email" %}
-   -

-
-
- - {% if enable_webhooks %} -
-
- -

- Webhooks
-   -

-
-
- {% endif %} - - {% if enable_slack %} -
- {% if enable_slack_btn %} - - -

- Slack
- {% trans "Chat" %} -

-
- {% else %} -
- -

- Slack
- {% trans "Chat" %} -

-
- {% endif %} -
- {% endif %} - - {% if enable_apprise %} -
-
- -

- Apprise
- {% trans "Push Notifications" %} -

-
-
- {% endif %} - - {% if enable_discord %} -
-
- -

- Discord
- {% trans "Chat" %} -

-
-
- {% endif %} - - {% if enable_linenotify %} -
-
- -

LINE Notify
Chat

-
-
- {% endif %} - - {% if enable_matrix %} -
-
- -

- Matrix
- {% trans "Chat" %} -

-
-
- {% endif %} - - {% if enable_mattermost %} -
-
- -

- Mattermost
- {% trans "Chat" %} -

-
-
- {% endif %} - - {% if enable_msteams %} -
-
- -

- Microsoft Teams
- {% trans "Chat" %} -

-
-
- {% endif %} - - {% if enable_opsgenie %} -
-
- -

- OpsGenie
- {% trans "Incident Management" %} -

-
-
- {% endif %} - - {% if enable_pd %} -
- {% if enable_pd_simple %} - - -

- PagerDuty
- {% trans "Incident Management" %} -

-
- {% else %} -
- -

- PagerDuty
- {% trans "Incident Management" %} -

-
- {% endif %} -
- {% endif %} - - {% if enable_pagertree %} -
-
- -

- PagerTree
- {% trans "Incident Management" %} -

-
-
- {% endif %} - - {% if enable_call %} -
-
- -

- {% trans "Phone Call" %}
-   -

-
-
- {% endif %} - - {% if enable_prometheus %} - - {% endif %} - - {% if enable_pushbullet %} -
-
- -

- Pushbullet
- {% trans "Push Notifications" %} -

-
-
- {% endif %} - - {% if enable_pushover %} - - {% endif %} - - {% if enable_shell %} -
-
- -

- {% trans "Shell Commands" %}
-   -

-
-
- {% endif %} - - {% if enable_signal %} -
-
- -

- {% trans "Signal" %}
- {% trans "Chat" %} -

-
-
- {% endif %} - - {% if enable_sms %} -
-
- -

- {% trans "SMS" %}
-   -

-
-
- {% endif %} - - {% if enable_spike %} -
-
- Spike.sh icon -

- Spike.sh
- {% trans "Incident Management" %} -

-
-
- {% endif %} - - {% if enable_telegram %} - - {% endif %} - - {% if enable_trello %} -
-
- -

- Trello
- {% trans "Project Management" %} -

-
-
- {% endif %} - - {% if enable_victorops %} -
-
- -

- Splunk On-Call
- {% trans "Incident Management" %} -

-
-
- {% endif %} - - {% if enable_whatsapp %} -
-
- -

- WhatsApp
- {% trans "Chat" %} -

-
-
- {% endif %} - - {% if enable_zulip %} -
-
- -

- Zulip
- {% trans "Chat" %} -

-
-
- {% endif %} -
- -
-
-

- {% blocktrans trimmed %} - What Can I Monitor With {{ site_name }}? - {% endblocktrans %} -

-
-
-

{% trans "Cron Jobs" %}

-

- {% blocktrans trimmed %} - {{ site_name }} monitoring is a great fit for cron jobs and cron-like - systems (systemd timers, Jenkins build jobs, Windows Scheduled Tasks, - wp-cron, uwsgi cron-like interface, Heroku Scheduler, ...). A failed - cron job often has no immediate visible consequences and can go - unnoticed for a long time. - {% endblocktrans %} -

- -

{% trans "Specific examples:" %}

-
    -
  • {% trans "Filesystem backups" %}
  • -
  • {% trans "Database backups" %}
  • -
  • {% trans "Daily, weekly, monthly report emails" %}
  • -
  • {% trans "SSL renewals" %}
  • -
  • {% trans "Business data import and sync" %}
  • -
  • {% trans "Antivirus scans" %}
  • -
  • {% trans "Dynamic DNS updates" %}
  • -
-
-
-

{% trans "Processes, Services, Servers" %}

- -

- {% blocktrans trimmed %} - You can use {{ site_name }} for lightweight server - monitoring: ensuring a particular system service or the whole server - is alive and healthy. Write a shell script that checks for a - specific condition, and pings {{ site_name }} if successful. Run the - shell script regularly. - {% endblocktrans %} -

- -

{% trans "Specific examples:" %}

-
    -
  • {% trans "Check a specific docker container is running" %}
  • -
  • {% trans "Check a specific application process is running" %}
  • -
  • {% trans "Check database replication lag" %}
  • -
  • {% trans "Check system resources: free disk, free RAM, ..." %}
  • -
  • - {% blocktrans trimmed %} - Send simple, unconditional "I'm alive" messages from your server - (or your NAS, router, Raspberry Pi, ...) - {% endblocktrans %} -
  • -
-
-
- -
- - {% if registration_open %} - - {% endif %} - -
-
- -{% include "front/signup_modal.html" %} - -{% endblock %} - -{% block scripts %} -{% compress js %} - - - - - -{% endcompress %} -{% endblock %}