-
Notifications
You must be signed in to change notification settings - Fork 207
PMM-14934 Fix admin pass creation #5220
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
base: v3
Are you sure you want to change the base?
Changes from all commits
85b10ff
684a5d7
8d49066
0d34611
2d272fa
6a49b7d
2610c54
b95465e
9da8b9e
ffbb30e
dd92ef4
59d805d
58a3bb7
e9c4f17
ca7d391
32fa432
11cf57b
9c1fef4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,42 +3,9 @@ | |
|
|
||
| - hosts: all | ||
| become: yes | ||
| gather_facts: yes | ||
| vars: | ||
| pmm_server_distribution: "docker" | ||
| gather_facts: no | ||
|
|
||
| tasks: | ||
| # pmm-managed checks that if /srv/pmm-distribution exists, it contains "docker", "ovf", "ami" or "digitalocean" - all lowercase. | ||
| # TODO: refactor the build pipelines to call post-build.yml with the distribution name provided in the variable (above). | ||
| # https://jira.percona.com/browse/PMM-4991 | ||
| - name: Create a distribution file for Docker | ||
| copy: | ||
| content: "{{ pmm_server_distribution}}" | ||
| dest: /srv/pmm-distribution | ||
| owner: pmm | ||
| group: root | ||
|
|
||
| - name: Remove pmm-managed database from PostgreSQL | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole set of tasks is now redundant since we wipe out the whole "/srv" directory, where the DB is stored. |
||
| postgresql_db: | ||
| login_user: postgres | ||
| name: pmm-managed | ||
| force: true | ||
| state: absent | ||
| environment: | ||
| PGPASSWORD: "{{ lookup('file', '/srv/.postgres_password') }}" | ||
|
|
||
| - name: Remove pmm-managed role from PostgreSQL database | ||
| postgresql_user: | ||
| name: pmm-managed | ||
| state: absent | ||
| environment: | ||
| PGPASSWORD: "{{ lookup('file', '/srv/.postgres_password') }}" | ||
|
|
||
| - name: Remove postgres password file so each container generates a unique one | ||
| file: | ||
| path: /srv/.postgres_password | ||
| state: absent | ||
|
|
||
| - name: Stop supervisord service | ||
| command: supervisorctl shutdown | ||
| become: true | ||
|
|
@@ -48,24 +15,21 @@ | |
| - name: Cleanup dnf cache | ||
| command: dnf clean all | ||
|
|
||
| - name: Cleanup build logs, data, config files and package cache | ||
| - name: Cleanup build logs and package cache | ||
| file: | ||
| path: "{{ item }}" | ||
| state: absent | ||
| loop: | ||
| - /srv/logs | ||
| - /var/log/dnf.log | ||
| - /var/log/secure | ||
| - /var/log/wtmp | ||
| - /var/log/clickhouse-server | ||
| - /var/log/clickhouse-keeper | ||
| - /var/log/nginx | ||
| - /var/lib/pgsql | ||
| - /var/lib/rpm | ||
| - /var/cache/dnf | ||
| - /var/cache/yum | ||
| - /srv/pmm-encryption.key | ||
| - /srv/pmm-agent/tmp | ||
| - /srv/pmm-agent/config | ||
| - /usr/local/percona/pmm/config/pmm-agent.yaml | ||
|
|
||
| - name: Remove users created by installers | ||
|
|
@@ -77,29 +41,6 @@ | |
| - clickhouse | ||
| - nginx | ||
|
|
||
| - name: Clean Clickhouse dir | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removals in this play are no longer necessary, since we clean up the whole "/srv" down below. |
||
| shell: find /srv/clickhouse -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf -- | ||
|
|
||
| - name: Clean pmm-server dir | ||
| shell: find /usr/share/pmm-server -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf -- | ||
|
|
||
| # This step is required because of a change between VictoriaMetrics 1.77.1 and 1.82.1. | ||
| # VictoriaMetrics tries to atomically rename directories in this folder on startup. | ||
| # With RedHat-based docker images the rename fails with an error "Invalid cross-device link". | ||
| # This is due to the way OverlayFS and kernel works. More info https://github.com/moby/moby/issues/25409 | ||
| # This step ensures the directory is empty on startup and the contents are recreated. | ||
| # This is not an issue if the folder is in a volume or mounted from the host OS. | ||
| - name: Recreate '/srv/victoriametrics' directory | ||
| file: | ||
| state: "{{ item }}" | ||
| path: /srv/victoriametrics | ||
| owner: pmm | ||
| group: root | ||
| mode: 0775 | ||
| loop: | ||
| - absent | ||
| - directory | ||
|
|
||
| - name: Remove auto-generated config files | ||
| file: | ||
| path: "/etc/supervisord.d/{{ item }}" | ||
|
|
@@ -112,34 +53,24 @@ | |
| - grafana.ini | ||
| - nomad-server.ini | ||
|
|
||
| - name: Create '/srv/logs' directory | ||
| file: | ||
| path: /srv/logs | ||
| state: directory | ||
| owner: pmm | ||
| group: root | ||
| mode: 0775 | ||
| - name: Clean pmm-server dir | ||
| shell: find /usr/share/pmm-server -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf -- | ||
|
|
||
| - name: Set ownership for Grafana plugins directory | ||
| - name: Clean /srv directory for fresh initialization on first start | ||
| file: | ||
| path: /srv/grafana/plugins | ||
| path: /srv | ||
| state: "{{ item }}" | ||
| owner: pmm | ||
| group: root | ||
| recurse: yes | ||
| state: directory | ||
| mode: 0775 | ||
| loop: | ||
| - absent | ||
| - directory | ||
|
|
||
| - name: Set ownership for backup directory | ||
| - name: Create empty log directory for nginx | ||
| file: | ||
| path: /srv/backup | ||
| owner: pmm | ||
| group: root | ||
| path: /var/log/nginx | ||
| state: directory | ||
| mode: 0775 | ||
|
|
||
| - name: Set ownership for Grafana dashboards version file | ||
| file: | ||
| path: /srv/grafana/PERCONA_DASHBOARDS_VERSION | ||
| owner: pmm | ||
| group: root | ||
| state: file | ||
| mode: 0755 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,12 +12,11 @@ events { | |
| } | ||
|
|
||
| http { | ||
| # Configure temporary directories to use /usr/share/pmm-server/nginx | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This moves Nginx temp directories to a mutable storage, which is where it should be. |
||
| client_body_temp_path /usr/share/pmm-server/nginx/client_temp; | ||
| proxy_temp_path /usr/share/pmm-server/nginx/proxy_temp; | ||
| fastcgi_temp_path /usr/share/pmm-server/nginx/fastcgi_temp; | ||
| uwsgi_temp_path /usr/share/pmm-server/nginx/uwsgi_temp; | ||
| scgi_temp_path /usr/share/pmm-server/nginx/scgi_temp; | ||
| client_body_temp_path /srv/nginx/tmp/client; | ||
| proxy_temp_path /srv/nginx/tmp/proxy; | ||
| fastcgi_temp_path /srv/nginx/tmp/fastcgi; | ||
| uwsgi_temp_path /srv/nginx/tmp/uwsgi; | ||
| scgi_temp_path /srv/nginx/tmp/scgi; | ||
|
|
||
| map $http_upgrade $connection_upgrade { | ||
| default upgrade; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,27 +73,13 @@ if [ "$CURRENT_UID" != "1000" ] || [ "$CURRENT_GID" != "0" ]; then | |
| echo "NSS wrapper enabled with $NSS_WRAPPER_LIB" | ||
| fi | ||
|
|
||
| # Check /usr/share/pmm-server directory on every start | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section was preceding "/srv" initialization below, which is wrong timing. Moved below it. |
||
| echo "Checking /usr/share/pmm-server directory structure..." | ||
| # Still ensure critical directories exist, but don't create empty ones | ||
| if [ ! -d "/usr/share/pmm-server/nginx" ]; then | ||
| echo "Creating nginx temp directories..." | ||
| mkdir -p /usr/share/pmm-server/nginx/{client_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} | ||
| fi | ||
|
|
||
| if [ ! -d "/srv/pmm-agent/tmp" ]; then | ||
| echo "Creating pmm-agent temp directory..." | ||
| install -d -m 770 /srv/pmm-agent/tmp | ||
| fi | ||
|
|
||
| # Initialize /srv if empty | ||
| declare DIST_FILE=/srv/pmm-distribution | ||
| if [ ! -f "$DIST_FILE" ]; then | ||
| echo -n "$PMM_DISTRIBUTION_METHOD" > "$DIST_FILE" | ||
| echo "Initializing /srv..." | ||
| mkdir -p /srv/{backup,clickhouse,grafana,logs,nginx,prometheus,victoriametrics} | ||
| mkdir -p /srv/{backup,clickhouse,grafana/plugins,logs,nginx,prometheus/rules,victoriametrics} | ||
| echo "Copying grafana plugins and the VERSION file..." | ||
| mkdir -p /srv/grafana/plugins | ||
| cp -r /usr/share/percona-dashboards/panels/* /srv/grafana/plugins | ||
|
|
||
| if is_enabled "$PMM_HA_ENABLE"; then | ||
|
|
@@ -125,6 +111,16 @@ if [ ! -f "$DIST_FILE" ]; then | |
| fi | ||
| fi | ||
|
|
||
| if [ ! -d "/srv/nginx/tmp" ]; then | ||
| echo "Creating nginx temp directories..." | ||
| mkdir -p /srv/nginx/tmp/{client,proxy,fastcgi,uwsgi,scgi} | ||
| fi | ||
|
|
||
| if [ ! -d "/srv/pmm-agent/tmp" ]; then | ||
| echo "Creating pmm-agent temp directory..." | ||
| install -d -m 770 /srv/pmm-agent/tmp | ||
| fi | ||
|
|
||
| if is_enabled "$PMM_HA_ENABLE"; then | ||
| echo "Skipping embedded PostgreSQL migration in HA mode." | ||
| elif is_enabled "$PMM_DISABLE_BUILTIN_POSTGRES"; then | ||
|
|
@@ -179,5 +175,5 @@ fi | |
|
|
||
| unset AGENT_CONFIG_DIR AGENT_ID | ||
|
|
||
| # Start supervisor in foreground | ||
| # Start supervisor in foreground, i.e. as PID 1 | ||
| exec supervisord -n -c /etc/supervisord.conf | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was redundant.