Skip to content
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

chore(db): update references to split-out database container #136

Merged
merged 11 commits into from
Nov 3, 2023
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ jobs:
run: systemctl --user enable --now podman.socket
- name: Set DOCKER_HOST environment variable
run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV"
- name: Build db image
run: sh db/build.sh
- name: Run tests
run: ./mvnw -B -U clean verify
continue-on-error: ${{ matrix.java != '17' }}
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Build Requirements:

Run Requirements:
- [`yq`](https://github.com/mikefarah/yq) v4.35.1+
- [`kompose`](https://kompose.io/installation/) v1.30.0+
- [`kompose`](https://kompose.io/installation/) v1.31.2+
- [docker-compose](https://docs.docker.com/compose/install/) v1.29.2
- [podman-docker](https://packages.fedoraproject.org/pkgs/podman/podman-docker/) (Optional)
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) / [oc](https://docs.openshift.com/container-platform/latest/cli_reference/openshift_cli/getting-started-cli.html)
Expand All @@ -51,12 +51,6 @@ $ yarn install && yarn yarn:frzinstall
$ cd -
```

### Build the custom database container image

```bash
$ sh db/build.sh
```

### Build the application container image

The application image can be created using:
Expand Down
8 changes: 0 additions & 8 deletions db/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions db/build.sh

This file was deleted.

9 changes: 0 additions & 9 deletions db/entrypoint.bash

This file was deleted.

1 change: 0 additions & 1 deletion db/include/postgresql-cfg/pgcrypto.conf

This file was deleted.

3 changes: 0 additions & 3 deletions db/include/postgresql-init/pgcrypto.sh

This file was deleted.

9 changes: 5 additions & 4 deletions smoketest.bash
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ for file in "${FILES[@]}"; do
CMD+=(-f "${file}")
done

HOSTSFILE="${HOSTSFILE:-$HOME/.hosts}"

cleanup() {
DOWN_FLAGS=('--remove-orphans')
if [ "${KEEP_VOLUMES}" != "true" ]; then
Expand All @@ -91,7 +93,7 @@ cleanup() {
"${CMD[@]}" \
down "${DOWN_FLAGS[@]}"
# podman kill hoster || true
> ~/.hosts
truncate -s 0 "${HOSTSFILE}"
}
trap cleanup EXIT
cleanup
Expand All @@ -109,16 +111,15 @@ setupUserHosts() {
# -v "${XDG_RUNTIME_DIR}/podman/podman.sock:/tmp/docker.sock:Z" \
# -v "${HOME}/.hosts:/tmp/hosts" \
# dvdarias/docker-hoster
> ~/.hosts
truncate -s 0 "${HOSTSFILE}"
for file in "${FILES[@]}" ; do
hosts="$(yq '.services.*.hostname' "${file}" | grep -v null | sed -e 's/^/localhost /')"
echo "${hosts}" >> ~/.hosts
echo "${hosts}" >> "${HOSTSFILE}"
done
}
setupUserHosts

if [ "${PULL_IMAGES}" = "true" ]; then
sh db/build.sh
IMAGES=()
for file in "${FILES[@]}" ; do
images="$(yq '.services.*.image' "${file}" | grep -v null)"
Expand Down
3 changes: 1 addition & 2 deletions smoketest/compose/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ services:
QUARKUS_DATASOURCE_PASSWORD: cryostat3
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://db:5432/cryostat3
db:
image: quay.io/cryostat/cryostat3-db:dev
build: ../../db
image: quay.io/andrewazores/cryostat-db:latest
hostname: db
expose:
- "5432"
Expand Down
16 changes: 5 additions & 11 deletions smoketest/compose/db_k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,17 @@ services:
QUARKUS_DATASOURCE_PASSWORD: cryostat3
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://db:5432/cryostat3
db:
image: quay.io/cryostat/cryostat3-db:dev
build: ../../db
entrypoint:
- /usr/local/bin/docker-entrypoint.sh
command:
- postgres
- -c
- encrypt.key=REPLACEME
image: quay.io/cryostat/cryostat-db:latest
hostname: db
expose:
- "5432"
environment:
POSTGRES_USER: cryostat3
POSTGRES_PASSWORD: cryostat3
POSTGRESQL_USER: cryostat3
POSTGRESQL_PASSWORD: cryostat3
POSTGRESQL_DATABASE: cryostat3
PG_ENCRYPT_KEY: REPLACEME
volumes:
- postgresql:/var/lib/postgresql/data
- postgresql:/var/lib/pgsql/data
restart: always
healthcheck:
test: pg_isready -U cryostat3 -d cryostat3 || exit 1
Expand Down
4 changes: 2 additions & 2 deletions smoketest/containers/smoketest_pod.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -x
set -e

HOSTSFILE="${HOSTSFILE:-~/.hosts}"
HOSTSFILE="${HOSTSFILE:-$HOME/.hosts}"

cleanup() {
podman-compose --in-pod=1 \
Expand All @@ -30,7 +30,7 @@ cleanup
# --user=0 \
# --security-opt label=disable \
# -v "${XDG_RUNTIME_DIR}/podman/podman.sock:/tmp/docker.sock:Z" \
# -v "${HOME}/.hosts:/tmp/hosts" \
# -v "${HOSTSFILE}:/tmp/hosts" \
# dvdarias/docker-hoster

setupUserHosts() {
Expand Down
14 changes: 14 additions & 0 deletions smoketest/k8s/compose-default-networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
creationTimestamp: null
name: compose-default
spec:
ingress:
- from:
- podSelector:
matchLabels:
io.kompose.network/compose-default: "true"
podSelector:
matchLabels:
io.kompose.network/compose-default: "true"
2 changes: 0 additions & 2 deletions smoketest/k8s/cryostat-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ metadata:
labels:
io.kompose.service: cryostat
name: cryostat
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -82,7 +81,6 @@ spec:
hostPort: 8181
protocol: TCP
- containerPort: 9091
hostPort: 9091
protocol: TCP
resources: {}
securityContext:
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/cryostat-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ metadata:
labels:
io.kompose.service: cryostat
name: cryostat
namespace: default
spec:
rules:
- host: cryostat3
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/cryostat-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ metadata:
labels:
io.kompose.service: cryostat
name: cryostat
namespace: default
spec:
ports:
- name: "8181"
Expand Down
20 changes: 7 additions & 13 deletions smoketest/k8s/db-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
replicas: 1
selector:
Expand All @@ -21,20 +20,16 @@ spec:
io.kompose.service: db
spec:
containers:
- args:
- postgres
- -c
- encrypt.key=REPLACEME
command:
- /usr/local/bin/docker-entrypoint.sh
env:
- env:
- name: PG_ENCRYPT_KEY
value: REPLACEME
- name: POSTGRES_PASSWORD
- name: POSTGRESQL_DATABASE
value: cryostat3
- name: POSTGRES_USER
- name: POSTGRESQL_PASSWORD
value: cryostat3
image: quay.io/cryostat/cryostat3-db:dev
- name: POSTGRESQL_USER
value: cryostat3
image: quay.io/cryostat/cryostat-db:latest
livenessProbe:
exec:
command:
Expand All @@ -46,11 +41,10 @@ spec:
name: db
ports:
- containerPort: 5432
hostPort: 5432
protocol: TCP
resources: {}
volumeMounts:
- mountPath: /var/lib/postgresql/data
- mountPath: /var/lib/pgsql/data
name: postgresql
hostname: db
restartPolicy: Always
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/db-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
ports:
- name: "5432"
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/db-viewer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
labels:
io.kompose.service: db-viewer
name: db-viewer
namespace: default
spec:
replicas: 1
selector:
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/db-viewer-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
labels:
io.kompose.service: db-viewer
name: db-viewer
namespace: default
spec:
rules:
- host: pgadmin
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/db-viewer-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
labels:
io.kompose.service: db-viewer
name: db-viewer
namespace: default
spec:
ports:
- name: "8989"
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/minio-certs-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: minio-certs
name: minio-certs
namespace: default
spec:
accessModes:
- ReadWriteOnce
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/minio-data-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: minio-data
name: minio-data
namespace: default
spec:
accessModes:
- ReadWriteOnce
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/pgadmin-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: pgadmin
name: pgadmin
namespace: default
spec:
accessModes:
- ReadWriteOnce
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/postgresql-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: postgresql
name: postgresql
namespace: default
spec:
accessModes:
- ReadWriteOnce
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/quarkus-test-agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: quarkus-test-agent
name: quarkus-test-agent
namespace: default
spec:
replicas: 1
selector:
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/quarkus-test-agent-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
labels:
io.kompose.service: quarkus-test-agent
name: quarkus-test-agent
namespace: default
spec:
ports:
- name: "9977"
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/s3-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
labels:
io.kompose.service: s3
name: s3
namespace: default
spec:
replicas: 1
selector:
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/s3-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
labels:
io.kompose.service: s3
name: s3
namespace: default
spec:
rules:
- host: minio
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/s3-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
labels:
io.kompose.service: s3
name: s3
namespace: default
spec:
ports:
- name: "9001"
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/sample-app-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ metadata:
labels:
io.kompose.service: sample-app
name: sample-app
namespace: default
spec:
replicas: 1
selector:
Expand Down
1 change: 0 additions & 1 deletion smoketest/k8s/sample-app-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ metadata:
labels:
io.kompose.service: sample-app
name: sample-app
namespace: default
spec:
ports:
- name: "8081"
Expand Down
Loading
Loading