-
-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provision of resources in a popular cloud providers for PostgreSQL cl…
…uster deployment (#464)
- Loading branch information
Showing
65 changed files
with
6,011 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,56 @@ | ||
# Activate virtual environment | ||
ACTIVATE_VENV = . .venv/bin/activate | ||
|
||
## —— Molecule ——————————————————————————————————————————————————————————————————————————————————— | ||
|
||
.PHONY: molecule-test | ||
molecule-test: ## Run test sequence for default scenario | ||
source .venv/bin/activate | ||
molecule test | ||
$(ACTIVATE_VENV) && molecule test | ||
|
||
.PHONY: molecule-destroy | ||
molecule-destroy: ## Run destroy sequence for default scenario | ||
source .venv/bin/activate | ||
molecule destroy | ||
$(ACTIVATE_VENV) && molecule destroy | ||
|
||
.PHONY: molecule-converge | ||
molecule-converge: ## Run converge sequence for default scenario | ||
source .venv/bin/activate | ||
molecule converge | ||
$(ACTIVATE_VENV) && molecule converge | ||
|
||
.PHONY: molecule-reconverge | ||
molecule-reconverge: ## Run destroy and converge sequence for default scenario | ||
source .venv/bin/activate | ||
molecule destroy | ||
molecule converge | ||
$(ACTIVATE_VENV) && molecule destroy && molecule converge | ||
|
||
.PHONY: molecule-test-all | ||
molecule-test-all: ## Run test sequence for all scenarios | ||
source .venv/bin/activate | ||
molecule test --all | ||
$(ACTIVATE_VENV) && molecule test --all | ||
|
||
.PHONY: molecule-destroy-all | ||
molecule-destroy-all: ## Run destroy sequence for all scenarios | ||
source .venv/bin/activate | ||
molecule destroy --all | ||
$(ACTIVATE_VENV) && molecule destroy --all | ||
|
||
.PHONY: molecule-test-scenario | ||
molecule-test-scenario: ## Run molecule test with specific scenario (example: make molecule-test-scenario MOLECULE_SCENARIO="postgrespro") | ||
source .venv/bin/activate | ||
molecule test --scenario-name $(MOLECULE_SCENARIO) | ||
molecule-test-scenario: ## Run molecule test with specific scenario (example: make molecule-test-scenario MOLECULE_SCENARIO="scenario_name") | ||
$(ACTIVATE_VENV) && molecule test --scenario-name $(MOLECULE_SCENARIO) | ||
|
||
.PHONY: molecule-destroy-scenario | ||
molecule-destroy-scenario: ## Run molecule destroy with specific scenario (example: make molecule-destroy-scenario MOLECULE_SCENARIO="postgrespro") | ||
source .venv/bin/activate | ||
molecule destroy --scenario-name $(MOLECULE_SCENARIO) | ||
molecule-destroy-scenario: ## Run molecule destroy with specific scenario (example: make molecule-destroy-scenario MOLECULE_SCENARIO="scenario_name") | ||
$(ACTIVATE_VENV) && molecule destroy --scenario-name $(MOLECULE_SCENARIO) | ||
|
||
.PHONY: molecule-converge-scenario | ||
molecule-converge-scenario: ## Run molecule converge with specific scenario (example: make molecule-converge-scenario MOLECULE_SCENARIO="postgrespro") | ||
source .venv/bin/activate | ||
molecule converge --scenario-name $(MOLECULE_SCENARIO) | ||
molecule-converge-scenario: ## Run molecule converge with specific scenario (example: make molecule-converge-scenario MOLECULE_SCENARIO="scenario_name") | ||
$(ACTIVATE_VENV) && molecule converge --scenario-name $(MOLECULE_SCENARIO) | ||
|
||
.PHONY: molecule-dependency | ||
molecule-dependency: ## Run dependency sequence | ||
source .venv/bin/activate | ||
molecule dependency | ||
$(ACTIVATE_VENV) && molecule dependency | ||
|
||
.PHONY: molecule-verify | ||
molecule-verify: ## Run verify sequence | ||
source .venv/bin/activate | ||
molecule verify | ||
$(ACTIVATE_VENV) && molecule verify | ||
|
||
.PHONY: molecule-login | ||
molecule-login: ## Log in to one instance using custom host IP (example: make molecule-login MOLECULE_HOST="10.172.0.20") | ||
source .venv/bin/activate | ||
molecule login --host $(MOLECULE_HOST) | ||
$(ACTIVATE_VENV) && molecule login --host $(MOLECULE_HOST) | ||
|
||
.PHONY: molecule-login-scenario | ||
molecule-login-scenario: ## Log in to one instance using custom host IP and scenario name (example: make molecule-login-scenario MOLECULE_HOST="10.172.1.20" MOLECULE_SCENARIO="postgrespro") | ||
source .venv/bin/activate | ||
molecule login --host $(MOLECULE_HOST) --scenario-name $(MOLECULE_SCENARIO) | ||
molecule-login-scenario: ## Log in to one instance using custom host IP and scenario name (example: make molecule-login-scenario MOLECULE_HOST="10.172.1.20" MOLECULE_SCENARIO="scenario_name") | ||
$(ACTIVATE_VENV) && molecule login --host $(MOLECULE_HOST) --scenario-name $(MOLECULE_SCENARIO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM debian:bookworm-slim | ||
LABEL maintainer="Vitaliy Kukharik [email protected]" | ||
|
||
USER root | ||
|
||
# Set SHELL to Bash to ensure pipefail is supported | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# Copy postgresql_cluster repository | ||
COPY . /postgresql_cluster | ||
|
||
# Install required packages, Python dependencies, Ansible requirements, and perform cleanup | ||
RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \ | ||
&& apt-get update -o Acquire::CompressionTypes::Order::=gz \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
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/requirements.txt \ | ||
&& ansible-galaxy install --force -r \ | ||
/postgresql_cluster/requirements.yml \ | ||
&& ansible-galaxy install --force -r \ | ||
/postgresql_cluster/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 \ | ||
&& curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null \ | ||
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/azure-cli.list \ | ||
&& apt-get update && apt-get install --no-install-recommends -y azure-cli \ | ||
&& 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/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 | ||
|
||
ENTRYPOINT ["./entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.