Skip to content

Commit

Permalink
PMM-12940 Run watchtower with AMI. (#3074)
Browse files Browse the repository at this point in the history
* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 Run watchtower next to pmm server container.

* PMM-12940 No restart container.

* PMM-12940 Increase disk space.

* PMM-12940 AMI Improvements.

* PMM-13053 Set instance ID as password.

* PMM-13053 Add role.

* PMM-12940 volume mount.

* PMM-12940 user mapping.

* PMM-12940 fix init-admin-password script.

* PMM-12940 fix roles init order.

* PMM-12940 fix roles init order.

* PMM-12940 Distribution method.

* PMM-12940 Make init-admin-password work.

* PMM-12940 Make init-admin-password wait until container is healthy.

* PMM-12940 PMM init order.

* PMM-12940 fix init-admin-password ansible job.

* PMM-12940 revert moving of lvm-init.

* PMM-12940 home directory and initialization.

* PMM-12940 home directory and initialization.

* PMM-12940 Fix test.

* PMM-12940 Fix initizalization.

* PMM-12940 Fix build.

* PMM-12940 Fix build.

* PMM-12940 Fix linters.

* PMM-12940 Fix linters.

* PMM-12940 Fix linters.

* PMM-12940 Set need_initialization correctly.

* PMM-12940 remove must setup.

* PMM-12940 use FB(should be reverted).

* PMM-12940 improve entrypoint.

* PMM-12940 use new PMM Image.

* PMM-12940 move init admin password into container.

* PMM-12940 detect AMI distribution.

* PMM-12940 default env var for PMM Server Image.

* PMM-12940 use new FB.

* PMM-12940 Fix build.

* PMM-12940 print environment file content.

* PMM-12940 fix entrypoint.

* PMM-12940 fix pmm distribution detection.

* PMM-12940 fix AMI detection.

* PMM-12940 fix AMI detection.

* PMM-12940 fix AMI detection.

* PMM-12940 change order on AMI build.

* PMM-12940 change admin user to pmm user in ansible.

* PMM-12940 fix logic of change admin password.

* PMM-12940 Drop additional file.

* PMM-12940 use ENV instead of file for AMI distribution.

* PMM-13053 Cleanup.

* PMM-13053 fix tests.

* PMM-13053 Add changelog.

* PMM-13063 remove unnecessary ansible step.

* PMM-13063 use 3-dev-latest instead of FB in makefile.

* PMM-12940 use custom docker image for OVF.

* PMM-13280 create .ssh directory on OVF.

* PMM-12940 ignore PMM ready errors.

* PMM-12940 create empty authorized_keys file.

* PMM-12940 update descriptors.

---------

Co-authored-by: Talha Bin Rizwan <[email protected]>
  • Loading branch information
BupycHuk and talhabinrizwan authored Aug 3, 2024
1 parent da25a0c commit ffea775
Show file tree
Hide file tree
Showing 43 changed files with 481 additions and 2,070 deletions.
91 changes: 0 additions & 91 deletions api-tests/server/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"net/http/httputil"
"net/url"
"strconv"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -98,96 +97,6 @@ func TestAuth(t *testing.T) {
})
}

func TestSetup(t *testing.T) {
t.Parallel()
// make a BaseURL without authentication
baseURL, err := url.Parse(pmmapitests.BaseURL.String())
require.NoError(t, err)
baseURL.User = nil

// make client that does not follow redirects
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}

t.Run("WebPage", func(t *testing.T) {
t.Parallel()

uri := baseURL.ResolveReference(&url.URL{
Path: "/setup",
})
t.Logf("URI: %s", uri)
req, err := http.NewRequestWithContext(pmmapitests.Context, http.MethodGet, uri.String(), nil)
require.NoError(t, err)
req.Header.Set("X-Test-Must-Setup", "1")

resp, b := doRequest(t, client, req) //nolint:bodyclose

assert.Equal(t, 200, resp.StatusCode, "response:\n%s", b)
assert.True(t, strings.HasPrefix(string(b), `<!doctype html>`), string(b))
})

t.Run("Redirect", func(t *testing.T) {
t.Parallel()
paths := map[string]int{
"graph": 303,
"graph/": 303,
"prometheus": 303,
"prometheus/": 303,
"swagger": 200,
"swagger/": 301,

"v1/server/readyz": 200,
"v1/server/AWSInstance": 400, // It must accept a parameter
"v1/server/version": 401, // Grafana authentication required
}
for path, code := range paths {
path, code := path, code
t.Run(fmt.Sprintf("%s=%d", path, code), func(t *testing.T) {
t.Parallel()

uri := baseURL.ResolveReference(&url.URL{
Path: path,
})
t.Logf("URI: %s", uri)
req, err := http.NewRequestWithContext(pmmapitests.Context, http.MethodGet, uri.String(), nil)
require.NoError(t, err)
req.Header.Set("X-Test-Must-Setup", "1")

resp, b := doRequest(t, client, req) //nolint:bodyclose

assert.Equal(t, code, resp.StatusCode, "response:\n%s", b)
if code == 303 {
assert.Equal(t, "/setup", resp.Header.Get("Location"))
}
})
}
})

t.Run("API", func(t *testing.T) {
t.Parallel()

q := make(url.Values)
q.Set("instance_id", "123")
uri := baseURL.ResolveReference(&url.URL{
Path: "v1/server/AWSInstance",
RawQuery: q.Encode(),
})
t.Logf("URI: %s", uri)
require.NoError(t, err)
req, err := http.NewRequestWithContext(pmmapitests.Context, http.MethodGet, uri.String(), nil)
require.NoError(t, err)
req.Header.Set("X-Test-Must-Setup", "1")

resp, b := doRequest(t, client, req) //nolint:bodyclose

assert.Equal(t, 200, resp.StatusCode, "response:\n%s", b)
assert.Equal(t, "{}", string(b), "response:\n%s", b)
})
}

func TestSwagger(t *testing.T) {
t.Parallel()
for _, path := range []string{
Expand Down

This file was deleted.

Loading

0 comments on commit ffea775

Please sign in to comment.