Skip to content

Commit 23d0219

Browse files
authored
PostgreSQL Cluster Console (UI/API) (#667)
1 parent 1cf159e commit 23d0219

File tree

714 files changed

+23531
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

714 files changed

+23531
-334
lines changed

.config/make/docker.mak

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,89 @@
22
TAG ?= local
33
DOCKER_REGISTRY ?= vitabaks
44

5-
.PHONY: docker-build
6-
docker-build: ## Run docker build image (example: make docker-build TAG=my_tag)
7-
@echo "Building container image with tag $(TAG)";
8-
docker build --no-cache --tag postgresql_cluster:$(TAG) --file Dockerfile .
9-
10-
.PHONY: docker-push
11-
docker-push: ## Push image to Dockerhub (example: make docker-push TAG=my_tag DOCKER_REGISTRY=my_repo DOCKER_REGISTRY_USER="my_username" DOCKER_REGISTRY_PASSWORD="my_password")
12-
@echo "Pushing container image with tag $(TAG)";
5+
.PHONY: docker-lint docker-lint-console-ui docker-lint-console-api docker-lint-console-db docker-lint-console
6+
docker-lint: docker-lint-automation docker-lint-console-ui docker-lint-console-api docker-lint-console-db docker-lint-console ## Lint all Dockerfiles
7+
8+
docker-lint-automation: ## Lint automation Dockerfile
9+
@echo "Lint automation container Dockerfile"
10+
docker run --rm -i -v $(PWD)/automation/Dockerfile:/Dockerfile \
11+
hadolint/hadolint hadolint --ignore DL3002 --ignore DL3008 --ignore DL3059 /Dockerfile
12+
13+
docker-lint-console-ui: ## Lint console ui Dockerfile
14+
@echo "Lint console ui container Dockerfile"
15+
docker run --rm -i -v $(PWD)/console/ui/Dockerfile:/Dockerfile \
16+
hadolint/hadolint hadolint --ignore DL3002 --ignore DL3008 --ignore DL3059 /Dockerfile
17+
18+
docker-lint-console-api: ## Lint console api Dockerfile
19+
@echo "Lint console api container Dockerfile"
20+
docker run --rm -i -v $(PWD)/console/service/Dockerfile:/Dockerfile \
21+
hadolint/hadolint hadolint --ignore DL3002 --ignore DL3008 --ignore DL3059 /Dockerfile
22+
23+
docker-lint-console-db: ## Lint console db Dockerfile
24+
@echo "Lint console db container Dockerfile"
25+
docker run --rm -i -v $(PWD)/console/db/Dockerfile:/Dockerfile \
26+
hadolint/hadolint hadolint --ignore DL3002 --ignore DL3008 --ignore DL3059 --ignore DL4001 /Dockerfile
27+
28+
docker-lint-console: ## Lint console Dockerfile (all services)
29+
@echo "Lint console container Dockerfile"
30+
docker run --rm -i -v $(PWD)/console/Dockerfile:/Dockerfile \
31+
hadolint/hadolint hadolint --ignore DL3002 --ignore DL3008 --ignore DL3059 --ignore DL4001 /Dockerfile
32+
33+
.PHONY: docker-build docker-build-console-ui docker-build-console-api docker-build-console-db docker-build-console
34+
docker-build: docker-build-automation docker-build-console-ui docker-build-console-api docker-build-console-db docker-build-console ## Build for all Docker images
35+
36+
docker-build-automation: ## Build automation image
37+
@echo "Build automation docker image with tag $(TAG)";
38+
docker build --no-cache --platform linux/amd64 --tag postgresql_cluster:$(TAG) --file automation/Dockerfile .
39+
40+
docker-build-console-ui: ## Build console ui image
41+
@echo "Build console ui docker image with tag $(TAG)"
42+
docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console_ui:$(TAG) --file console/ui/Dockerfile .
43+
44+
docker-build-console-api: ## Build console api image
45+
@echo "Build console api docker image with tag $(TAG)"
46+
docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console_api:$(TAG) --file console/service/Dockerfile .
47+
48+
docker-build-console-db: ## Build console db image
49+
@echo "Build console db docker image with tag $(TAG)"
50+
docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console_db:$(TAG) --file console/db/Dockerfile .
51+
52+
docker-build-console: ## Build console image (all services)
53+
@echo "Build console docker image with tag $(TAG)"
54+
docker build --no-cache --platform linux/amd64 --tag postgresql_cluster_console:$(TAG) --file console/Dockerfile .
55+
56+
.PHONY: docker-push docker-push-console-ui docker-push-console-api docker-push-console-db docker-push-console
57+
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")
58+
59+
docker-push-automation: ## Push automation to Dockerhub
60+
@echo "Push automation docker image with tag $(TAG)";
1361
echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin
1462
docker tag postgresql_cluster:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster:$(TAG)
1563
docker push $(DOCKER_REGISTRY)/postgresql_cluster:$(TAG)
1664

17-
.PHONY: docker-lint
18-
docker-lint: ## Run hadolint command to lint Dokerfile
19-
docker run --rm -i -v ./Dockerfile:/Dockerfile \
20-
hadolint/hadolint hadolint --ignore DL3002 --ignore DL3008 --ignore DL3059 /Dockerfile
65+
docker-push-console-ui: ## Push console ui image to Dockerhub
66+
@echo "Push console ui docker image with tag $(TAG)"
67+
echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin
68+
docker tag postgresql_cluster_console_ui:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console_ui:$(TAG)
69+
docker push $(DOCKER_REGISTRY)/postgresql_cluster_console_ui:$(TAG)
70+
71+
docker-push-console-api: ## Push console api image to Dockerhub
72+
@echo "Push console api docker image with tag $(TAG)"
73+
echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin
74+
docker tag postgresql_cluster_console_api:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console_api:$(TAG)
75+
docker push $(DOCKER_REGISTRY)/postgresql_cluster_console_api:$(TAG)
76+
77+
docker-push-console-db: ## Push console db image to Dockerhub
78+
@echo "Push console db docker image with tag $(TAG)"
79+
echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin
80+
docker tag postgresql_cluster_console_db:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console_db:$(TAG)
81+
docker push $(DOCKER_REGISTRY)/postgresql_cluster_console_db:$(TAG)
82+
83+
docker-push-console: ## Push console image to Dockerhub (all services)
84+
@echo "Push console docker image with tag $(TAG)"
85+
echo "$(DOCKER_REGISTRY_PASSWORD)" | docker login --username "$(DOCKER_REGISTRY_USER)" --password-stdin
86+
docker tag postgresql_cluster_console:$(TAG) $(DOCKER_REGISTRY)/postgresql_cluster_console:$(TAG)
87+
docker push $(DOCKER_REGISTRY)/postgresql_cluster_console:$(TAG)
2188

2289
.PHONY: docker-tests
2390
docker-tests: ## Run tests for docker

.config/make/linters.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ linter-yamllint: ## Lint YAML files using yamllint
1717
linter-ansible-lint: ## Lint Ansible files using ansible-lint
1818
echo "ansible-lint #########################################################"
1919
$(ACTIVATE_VENV) && \
20-
ansible-lint --force-color --parseable
20+
ansible-lint --force-color --parseable ./automation
2121

2222
.PHONY: linter-flake8
2323
linter-flake8: ## Lint Python files using flake8

.config/make/molecule.mak

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,52 @@ ACTIVATE_VENV = . .venv/bin/activate
55

66
.PHONY: molecule-test
77
molecule-test: ## Run test sequence for default scenario
8-
$(ACTIVATE_VENV) && molecule test
8+
$(ACTIVATE_VENV) && cd automation && molecule test
99

1010
.PHONY: molecule-destroy
1111
molecule-destroy: ## Run destroy sequence for default scenario
12-
$(ACTIVATE_VENV) && molecule destroy
12+
$(ACTIVATE_VENV) && cd automation && molecule destroy
1313

1414
.PHONY: molecule-converge
1515
molecule-converge: ## Run converge sequence for default scenario
16-
$(ACTIVATE_VENV) && molecule converge
16+
$(ACTIVATE_VENV) && cd automation && molecule converge
1717

1818
.PHONY: molecule-reconverge
1919
molecule-reconverge: ## Run destroy and converge sequence for default scenario
20-
$(ACTIVATE_VENV) && molecule destroy && molecule converge
20+
$(ACTIVATE_VENV) && cd automation && molecule destroy && && molecule converge
2121

2222
.PHONY: molecule-test-all
2323
molecule-test-all: ## Run test sequence for all scenarios
24-
$(ACTIVATE_VENV) && molecule test --all
24+
$(ACTIVATE_VENV) && cd automation && molecule test --all
2525

2626
.PHONY: molecule-destroy-all
2727
molecule-destroy-all: ## Run destroy sequence for all scenarios
28-
$(ACTIVATE_VENV) && molecule destroy --all
28+
$(ACTIVATE_VENV) && cd automation && molecule destroy --all
2929

3030
.PHONY: molecule-test-scenario
3131
molecule-test-scenario: ## Run molecule test with specific scenario (example: make molecule-test-scenario MOLECULE_SCENARIO="scenario_name")
32-
$(ACTIVATE_VENV) && molecule test --scenario-name $(MOLECULE_SCENARIO)
32+
$(ACTIVATE_VENV) && cd automation && molecule test --scenario-name $(MOLECULE_SCENARIO)
3333

3434
.PHONY: molecule-destroy-scenario
3535
molecule-destroy-scenario: ## Run molecule destroy with specific scenario (example: make molecule-destroy-scenario MOLECULE_SCENARIO="scenario_name")
36-
$(ACTIVATE_VENV) && molecule destroy --scenario-name $(MOLECULE_SCENARIO)
36+
$(ACTIVATE_VENV) && cd automation && molecule destroy --scenario-name $(MOLECULE_SCENARIO)
3737

3838
.PHONY: molecule-converge-scenario
3939
molecule-converge-scenario: ## Run molecule converge with specific scenario (example: make molecule-converge-scenario MOLECULE_SCENARIO="scenario_name")
40-
$(ACTIVATE_VENV) && molecule converge --scenario-name $(MOLECULE_SCENARIO)
40+
$(ACTIVATE_VENV) && cd automation && molecule converge --scenario-name $(MOLECULE_SCENARIO)
4141

4242
.PHONY: molecule-dependency
4343
molecule-dependency: ## Run dependency sequence
44-
$(ACTIVATE_VENV) && molecule dependency
44+
$(ACTIVATE_VENV) && cd automation && molecule dependency
4545

4646
.PHONY: molecule-verify
4747
molecule-verify: ## Run verify sequence
48-
$(ACTIVATE_VENV) && molecule verify
48+
$(ACTIVATE_VENV) && cd automation && molecule verify
4949

5050
.PHONY: molecule-login
5151
molecule-login: ## Log in to one instance using custom host IP (example: make molecule-login MOLECULE_HOST="10.172.0.20")
52-
$(ACTIVATE_VENV) && molecule login --host $(MOLECULE_HOST)
52+
$(ACTIVATE_VENV) && cd automation && molecule login --host $(MOLECULE_HOST)
5353

5454
.PHONY: molecule-login-scenario
5555
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")
56-
$(ACTIVATE_VENV) && molecule login --host $(MOLECULE_HOST) --scenario-name $(MOLECULE_SCENARIO)
56+
$(ACTIVATE_VENV) && cd automation && molecule login --host $(MOLECULE_HOST) --scenario-name $(MOLECULE_SCENARIO)

.config/make/python.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Python default launcher
22
python_launcher ?= python3.10
3-
python_requirements_file ?= requirements.txt
3+
python_requirements_file ?= automation/requirements.txt
44
python_requirements_dev_file ?= .config/python/dev/requirements.txt
55

66
# Activate virtual environment

.github/workflows/docker.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,21 @@ jobs:
2020
run: echo "TERM=xterm" >> $GITHUB_ENV
2121

2222
- name: Extract branch or tag name
23-
shell: bash
2423
run: |
25-
REF_NAME=""
2624
if [[ -n "${GITHUB_HEAD_REF}" ]]; then
2725
# This is a PR, use the source branch name
28-
REF_NAME="${GITHUB_HEAD_REF}"
26+
echo "REF_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
2927
else
3028
# This is a push, use the branch or tag name from GITHUB_REF
31-
REF_NAME="${GITHUB_REF##*/}"
29+
echo "REF_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
3230
fi
3331
34-
# If this is the master branch, use 'latest' as the tag, otherwise use the REF_NAME
35-
if [[ "$REF_NAME" == "master" ]]; then
32+
- name: Set TAG
33+
run: |
34+
if [[ "${{ env.REF_NAME }}" == "master" ]]; then
3635
echo "TAG=latest" >> $GITHUB_ENV
3736
else
38-
echo "TAG=$REF_NAME" >> $GITHUB_ENV
37+
echo "TAG=${{ env.REF_NAME }}" >> $GITHUB_ENV
3938
fi
4039
4140
- name: Checkout

0 commit comments

Comments
 (0)