From 2aef285058aa0661b09c1c7b8c9d12c623d64454 Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik Date: Thu, 28 Nov 2024 17:10:21 +0300 Subject: [PATCH] rename postgresql_cluster to autobase --- .config/make/docker.mak | 30 ++++++++-------- CONTRIBUTING.md | 10 +++--- README.md | 4 +-- automation/Dockerfile | 14 ++++---- automation/entrypoint.sh | 6 ++-- .../roles/upgrade/tasks/update_config.yml | 1 - automation/vars/Debian.yml | 2 +- automation/vars/RedHat.yml | 2 +- ...40520144338_2.0.0_initial_scheme_setup.sql | 2 +- .../service/internal/configuration/config.go | 2 +- ...de.png => pg_cluster_scheme.dark_mode.png} | Bin ...esql_cluster.png => pg_cluster_scheme.png} | Bin meta/main.yml | 33 ------------------ meta/runtime.yml | 2 -- 14 files changed, 36 insertions(+), 72 deletions(-) rename images/{postgresql_cluster.dark_mode.png => pg_cluster_scheme.dark_mode.png} (100%) rename images/{postgresql_cluster.png => pg_cluster_scheme.png} (100%) delete mode 100644 meta/main.yml delete mode 100644 meta/runtime.yml diff --git a/.config/make/docker.mak b/.config/make/docker.mak index 5366f5364..42f490e5c 100644 --- a/.config/make/docker.mak +++ b/.config/make/docker.mak @@ -35,23 +35,23 @@ docker-build: docker-build-automation docker-build-console-ui docker-build-conso docker-build-automation: ## Build automation image @echo "Build automation docker image with tag $(TAG)"; - docker build --no-cache --platform linux/amd64 --tag postgresql_cluster:$(TAG) --file automation/Dockerfile . + docker build --no-cache --platform linux/amd64 --tag automation:$(TAG) --file automation/Dockerfile . docker-build-console-ui: ## Build console ui image @echo "Build console ui docker image with tag $(TAG)" - docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console_ui:$(TAG) --file console/ui/Dockerfile . + docker build --no-cache --platform linux/amd64 --tag console_ui:$(TAG) --file console/ui/Dockerfile . docker-build-console-api: ## Build console api image @echo "Build console api docker image with tag $(TAG)" - docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console_api:$(TAG) --file console/service/Dockerfile . + docker build --no-cache --platform linux/amd64 --tag console_api:$(TAG) --file console/service/Dockerfile . docker-build-console-db: ## Build console db image @echo "Build console db docker image with tag $(TAG)" - docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console_db:$(TAG) --file console/db/Dockerfile . + docker build --no-cache --platform linux/amd64 --tag console_db:$(TAG) --file console/db/Dockerfile . docker-build-console: ## Build console image (all services) @echo "Build console docker image with tag $(TAG)" - docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console:$(TAG) --file console/Dockerfile . + docker build --no-cache --platform linux/amd64 --tag console:$(TAG) --file console/Dockerfile . .PHONY: docker-push docker-push-console-ui docker-push-console-api docker-push-console-db docker-push-console docker-push: docker-push-automation docker-push-console-ui docker-push-console-api docker-push-console-db docker-push-console ## Push all images to Dockerhub (example: make docker-push TAG=my_tag DOCKER_REGISTRY=my_repo DOCKER_REGISTRY_USER="my_username" DOCKER_REGISTRY_PASSWORD="my_password") @@ -59,32 +59,32 @@ docker-push: docker-push-automation docker-push-console-ui docker-push-console-a docker-push-automation: ## Push automation to Dockerhub @echo "Push automation docker image with tag $(TAG)"; echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin - docker tag postgresql_cluster:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster:$(TAG) - docker push $(DOCKER_REGISTRY)/postgresql_cluster:$(TAG) + docker tag automation:$(TAG) $(DOCKER_REGISTRY)/automation:$(TAG) + docker push $(DOCKER_REGISTRY)/automation:$(TAG) docker-push-console-ui: ## Push console ui image to Dockerhub @echo "Push console ui docker image with tag $(TAG)" echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin - docker tag postgresql_cluster_console_ui:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console_ui:$(TAG) - docker push $(DOCKER_REGISTRY)/postgresql_cluster_console_ui:$(TAG) + docker tag console_ui:$(TAG) $(DOCKER_REGISTRY)/console_ui:$(TAG) + docker push $(DOCKER_REGISTRY)/console_ui:$(TAG) docker-push-console-api: ## Push console api image to Dockerhub @echo "Push console api docker image with tag $(TAG)" echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin - docker tag postgresql_cluster_console_api:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console_api:$(TAG) - docker push $(DOCKER_REGISTRY)/postgresql_cluster_console_api:$(TAG) + docker tag console_api:$(TAG) $(DOCKER_REGISTRY)/console_api:$(TAG) + docker push $(DOCKER_REGISTRY)/console_api:$(TAG) docker-push-console-db: ## Push console db image to Dockerhub @echo "Push console db docker image with tag $(TAG)" echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin - docker tag postgresql_cluster_console_db:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console_db:$(TAG) - docker push $(DOCKER_REGISTRY)/postgresql_cluster_console_db:$(TAG) + docker tag console_db:$(TAG) $(DOCKER_REGISTRY)/console_db:$(TAG) + docker push $(DOCKER_REGISTRY)/console_db:$(TAG) docker-push-console: ## Push console image to Dockerhub (all services) @echo "Push console docker image with tag $(TAG)" echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin - docker tag postgresql_cluster_console:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console:$(TAG) - docker push $(DOCKER_REGISTRY)/postgresql_cluster_console:$(TAG) + docker tag console:$(TAG) $(DOCKER_REGISTRY)/console:$(TAG) + docker push $(DOCKER_REGISTRY)/console:$(TAG) .PHONY: docker-tests docker-tests: ## Run tests for docker diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6628dc2e2..7035d5846 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,18 +11,18 @@ Your contributions are appreciated and will be taken seriously. ### 1. Create an issue -Report problems or suggest improvements by [creating an issue](https://github.com/vitabaks/postgresql_cluster/issues). +Report problems or suggest improvements by [creating an issue](https://github.com/vitabaks/autobase/issues). ### 2. Fork the project -[Fork the repository](https://github.com/vitabaks/postgresql_cluster) to your GitHub account. +[Fork the repository](https://github.com/vitabaks/autobase) to your GitHub account. ### 3. Make changes Clone your fork locally and make the necessary changes: ```bash -git clone git@github.com:YOURNAMESPACE/postgresql_cluster.git +git clone git@github.com:YOURNAMESPACE/autobase.git ``` ### 4. Test your changes (Optional) @@ -32,8 +32,8 @@ git clone git@github.com:YOURNAMESPACE/postgresql_cluster.git Use Gitpod for a cloud-based development environment: 1. Sign up for Gitpod: https://gitpod.io -2. Fork the `postgresql_cluster` repository -3. Open your fork in Gitpod: `https://gitpod.io/#https://github.com/username/postgresql_cluster` +2. Fork the `autobase` repository +3. Open your fork in Gitpod: `https://gitpod.io/#https://github.com/username/autobase` 4. Create a new branch: `git checkout -b my-feature-branch` 5. Make your changes and commit: `git add .` and `git commit -m "Description of changes"` 6. Test with Molecule: `make tests` or `make tests-fast` diff --git a/README.md b/README.md index 8b0e0b0cf..bdcd1a89f 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ You can find a version of this documentation that is searchable and also easier ### Supported setups of Postgres Cluster -![pg_cluster_scheme](images/postgresql_cluster.png#gh-light-mode-only) -![pg_cluster_scheme](images/postgresql_cluster.dark_mode.png#gh-dark-mode-only) +![pg_cluster_scheme](images/pg_cluster_scheme.png#gh-light-mode-only) +![pg_cluster_scheme](images/pg_cluster_scheme.dark_mode.png#gh-dark-mode-only) You have three schemes available for deployment: diff --git a/automation/Dockerfile b/automation/Dockerfile index 1552d0ecf..7264259a3 100644 --- a/automation/Dockerfile +++ b/automation/Dockerfile @@ -6,8 +6,8 @@ USER root # Set SHELL to Bash to ensure pipefail is supported SHELL ["/bin/bash", "-o", "pipefail", "-c"] -# Copy postgresql_cluster repository -COPY automation /postgresql_cluster/automation +# Copy autobase repository +COPY automation /autobase/automation # Install required packages, Python dependencies, Ansible requirements, and perform cleanup RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \ @@ -16,11 +16,11 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \ ca-certificates gnupg git python3 python3-dev python3-pip keychain ssh-client sshpass\ gcc g++ cmake make libssl-dev curl apt-transport-https lsb-release gnupg \ && pip3 install --break-system-packages --no-cache-dir -r \ - /postgresql_cluster/automation/requirements.txt \ + /autobase/automation/requirements.txt \ && ansible-galaxy install --force -r \ - /postgresql_cluster/automation/requirements.yml \ + /autobase/automation/requirements.yml \ && ansible-galaxy install --force -r \ - /postgresql_cluster/automation/roles/consul/requirements.yml \ + /autobase/automation/roles/consul/requirements.yml \ && ansible-galaxy collection list \ && pip3 install --break-system-packages --no-cache-dir -r \ /root/.ansible/collections/ansible_collections/azure/azcollection/requirements.txt \ @@ -30,12 +30,12 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \ && apt-get autoremove -y --purge gnupg git python3-dev gcc g++ cmake make libssl-dev \ && apt-get clean -y autoclean \ && rm -rf /var/lib/apt/lists/* /tmp/* \ - && chmod +x /postgresql_cluster/automation/entrypoint.sh + && chmod +x /autobase/automation/entrypoint.sh # Set environment variable for Ansible collections paths ENV ANSIBLE_COLLECTIONS_PATH=/root/.ansible/collections/ansible_collections:/usr/local/lib/python3.11/dist-packages/ansible_collections ENV USER=root -WORKDIR /postgresql_cluster/automation +WORKDIR /autobase/automation ENTRYPOINT ["./entrypoint.sh"] diff --git a/automation/entrypoint.sh b/automation/entrypoint.sh index 76a32780a..9068df6da 100644 --- a/automation/entrypoint.sh +++ b/automation/entrypoint.sh @@ -13,13 +13,13 @@ is_base64() { if [[ -n "${ANSIBLE_INVENTORY_JSON}" ]]; then if is_base64 "${ANSIBLE_INVENTORY_JSON}"; then echo "Creating inventory.json with the (base64 decoded) content of ANSIBLE_INVENTORY_JSON" - echo "${ANSIBLE_INVENTORY_JSON}" | base64 -d > /postgresql_cluster/inventory.json + echo "${ANSIBLE_INVENTORY_JSON}" | base64 -d > /autobase/inventory.json else echo "Creating inventory.json with the content of ANSIBLE_INVENTORY_JSON" - echo "${ANSIBLE_INVENTORY_JSON}" > /postgresql_cluster/inventory.json + echo "${ANSIBLE_INVENTORY_JSON}" > /autobase/inventory.json fi # Set ANSIBLE_INVENTORY environment variable - export ANSIBLE_INVENTORY=/postgresql_cluster/inventory.json + export ANSIBLE_INVENTORY=/autobase/inventory.json # Set ANSIBLE_SSH_ARGS environment variable export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=no" fi diff --git a/automation/roles/upgrade/tasks/update_config.yml b/automation/roles/upgrade/tasks/update_config.yml index 0e96ff120..cfefa6517 100644 --- a/automation/roles/upgrade/tasks/update_config.yml +++ b/automation/roles/upgrade/tasks/update_config.yml @@ -7,7 +7,6 @@ dest: "{{ patroni_config_file }}.bkp" remote_src: true -# https://github.com/vitabaks/postgresql_cluster/issues/666 - name: Remove patroni.dynamic.json file ansible.builtin.file: path: "{{ pg_old_datadir }}/patroni.dynamic.json" diff --git a/automation/vars/Debian.yml b/automation/vars/Debian.yml index e0b076795..5e2d99900 100644 --- a/automation/vars/Debian.yml +++ b/automation/vars/Debian.yml @@ -151,7 +151,7 @@ haproxy_compile_requirements: # ================================================================================================= # # Offline installation (if installation_method: "file") # -# You can also download the necessary packages into postgresql_cluster/files/ directory. +# You can also download the necessary packages into /autobase/automation/files/ directory. # Packages from this directory will be used for installation. # if installation_method: "file" and patroni_installation_method: "deb" diff --git a/automation/vars/RedHat.yml b/automation/vars/RedHat.yml index f838ed97d..46e158bcc 100644 --- a/automation/vars/RedHat.yml +++ b/automation/vars/RedHat.yml @@ -176,7 +176,7 @@ haproxy_compile_requirements: # ================================================================================================= # # Offline installation (if installation_method: "file") # -# You can also download the necessary packages into postgresql_cluster/files/ directory. +# You can also download the necessary packages into /autobase/automation/files/ directory. # Packages from this directory will be used for installation. # if installation_method: "file" and patroni_installation_method: "rpm" diff --git a/console/db/migrations/20240520144338_2.0.0_initial_scheme_setup.sql b/console/db/migrations/20240520144338_2.0.0_initial_scheme_setup.sql index 27ba92317..9c10d1a7d 100644 --- a/console/db/migrations/20240520144338_2.0.0_initial_scheme_setup.sql +++ b/console/db/migrations/20240520144338_2.0.0_initial_scheme_setup.sql @@ -958,7 +958,7 @@ CREATE TABLE public.postgres_versions ( end_of_life date ); -COMMENT ON TABLE public.postgres_versions IS 'Table containing the major PostgreSQL versions supported by the postgresql_cluster'; +COMMENT ON TABLE public.postgres_versions IS 'Table containing the major PostgreSQL versions supported by the autobase'; COMMENT ON COLUMN public.postgres_versions.major_version IS 'The major version of PostgreSQL'; COMMENT ON COLUMN public.postgres_versions.release_date IS 'The release date of the PostgreSQL version'; COMMENT ON COLUMN public.postgres_versions.end_of_life IS 'The end of life date for the PostgreSQL version'; diff --git a/console/service/internal/configuration/config.go b/console/service/internal/configuration/config.go index 5f44fde57..45a6c90b2 100644 --- a/console/service/internal/configuration/config.go +++ b/console/service/internal/configuration/config.go @@ -43,7 +43,7 @@ type Config struct { Docker struct { Host string `default:"unix:///var/run/docker.sock" desc:"Docker host"` LogDir string `default:"/tmp/ansible" desc:"Directory inside docker container for ansible json log"` - Image string `default:"vitabaks/postgresql_cluster:2.0.0" desc:"Docker image for postgresql_cluster"` + Image string `default:"autobase/automation:2.0.0" desc:"Docker image for autobase automation"` } LogWatcher struct { RunEvery time.Duration `default:"1m" desc:"LogWatcher run interval"` diff --git a/images/postgresql_cluster.dark_mode.png b/images/pg_cluster_scheme.dark_mode.png similarity index 100% rename from images/postgresql_cluster.dark_mode.png rename to images/pg_cluster_scheme.dark_mode.png diff --git a/images/postgresql_cluster.png b/images/pg_cluster_scheme.png similarity index 100% rename from images/postgresql_cluster.png rename to images/pg_cluster_scheme.png diff --git a/meta/main.yml b/meta/main.yml deleted file mode 100644 index 1c66ea939..000000000 --- a/meta/main.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -galaxy_info: - role_name: postgresql_cluster - description: PostgreSQL High-Availability Cluster (based on Patroni) - namespace: vitabaks - author: Vitaliy Kukharik (vitabaks@gmail.com) - license: MIT - - min_ansible_version: "2.11.0" - - platforms: - - name: EL - versions: - - "7" - - "8" - - "9" - - name: Debian - versions: - - buster - - bullseye - - name: Ubuntu - versions: - - bionic - - focal - - jammy - - galaxy_tags: - - postgresql - - cluster - - patroni - - etcd - -dependencies: [] diff --git a/meta/runtime.yml b/meta/runtime.yml deleted file mode 100644 index be99ccf4b..000000000 --- a/meta/runtime.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -requires_ansible: '>=2.14.0'