Skip to content

Commit e0a9cec

Browse files
authored
Merge pull request #60 from code0-tech/44-add-boot-tests
Add boot test for sagittarius rails-web
2 parents fadef0a + 529d7dd commit e0a9cec

5 files changed

Lines changed: 163 additions & 93 deletions

File tree

.gitlab-ci.yml

Lines changed: 3 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
stages:
22
- container
3+
- container:boot
34

45
.dind:
56
variables:
@@ -13,95 +14,5 @@ stages:
1314
alias: docker
1415
entrypoint: [ "sh", "-c", "dockerd-entrypoint.sh $DOCKER_OPTIONS" ]
1516

16-
.image-build-base:
17-
extends:
18-
- .dind
19-
image: ghcr.io/code0-tech/build-images/reticulum-builder:171.1-ruby-3.2.2
20-
stage: container
21-
script:
22-
- source scripts/helpers.sh
23-
- docker_login
24-
- 'image=$(echo "$CI_JOB_NAME" | cut -d : -f 2)'
25-
- '[ -z "$NEED_PROJECT_DOWNLOAD" ] || download_project $image'
26-
27-
.single-image-build-base:
28-
extends:
29-
- .image-build-base
30-
script:
31-
- !reference [.image-build-base, script]
32-
- build_image $image $CI_PIPELINE_ID
33-
- push_image $image $CI_PIPELINE_ID
34-
35-
.variant-image-build-base:
36-
extends:
37-
- .image-build-base
38-
script:
39-
- !reference [.image-build-base, script]
40-
- build_image $image $CI_PIPELINE_ID "--build-arg VARIANT=$VARIANT"
41-
- image_tag=$(get_image_tag $CI_PIPELINE_ID $VARIANT)
42-
- retag_image $image $CI_PIPELINE_ID $image_tag
43-
- push_image $image $image_tag
44-
45-
container:mise:
46-
extends:
47-
- .single-image-build-base
48-
49-
container:rust:
50-
extends:
51-
- .single-image-build-base
52-
needs:
53-
- container:mise
54-
55-
container:aquila:
56-
extends:
57-
- .single-image-build-base
58-
needs:
59-
- container:rust
60-
variables:
61-
NEED_PROJECT_DOWNLOAD: 'true'
62-
63-
container:draco:
64-
extends:
65-
- .variant-image-build-base
66-
needs:
67-
- container:rust
68-
variables:
69-
NEED_PROJECT_DOWNLOAD: 'true'
70-
parallel:
71-
matrix:
72-
- VARIANT:
73-
- rest
74-
75-
container:taurus:
76-
extends:
77-
- .single-image-build-base
78-
needs:
79-
- container:rust
80-
variables:
81-
NEED_PROJECT_DOWNLOAD: 'true'
82-
83-
container:ruby:
84-
extends:
85-
- .single-image-build-base
86-
needs:
87-
- container:mise
88-
89-
container:postgresql:
90-
extends:
91-
- .single-image-build-base
92-
needs:
93-
- container:mise
94-
95-
container:sagittarius:
96-
extends:
97-
- .variant-image-build-base
98-
needs:
99-
- container:ruby
100-
- container:postgresql
101-
variables:
102-
NEED_PROJECT_DOWNLOAD: 'true'
103-
parallel:
104-
matrix:
105-
- VARIANT:
106-
- ce
107-
- ee
17+
include:
18+
- local: .gitlab/ci/*.gitlab-ci.yml
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.container:boot:
2+
extends:
3+
- .dind
4+
stage: container:boot
5+
image: ghcr.io/code0-tech/build-images/reticulum-builder:171.1-ruby-3.2.2
6+
7+
.container:boot:sagittarius:
8+
extends:
9+
- .container:boot
10+
needs:
11+
- container:sagittarius
12+
parallel:
13+
matrix:
14+
- VARIANT:
15+
- ce
16+
- ee
17+
variables:
18+
SAGITTARIUS_IMAGE: ghcr.io/code0-tech/reticulum/ci-builds/sagittarius:${CI_PIPELINE_ID}-${VARIANT}
19+
CURL_IMAGE: curlimages/curl:8.5.0
20+
before_script:
21+
- docker network create boot
22+
- >
23+
docker run
24+
--detach
25+
--name postgres
26+
--network boot
27+
--network-alias postgres
28+
--env POSTGRES_USER=sagittarius
29+
--env POSTGRES_PASSWORD=sagittarius
30+
--env POSTGRES_DB=sagittarius_production
31+
postgres:16.1
32+
- docker pull $SAGITTARIUS_IMAGE
33+
- docker pull $CURL_IMAGE
34+
- >
35+
docker run
36+
--name sagittarius
37+
--network boot
38+
--network-alias sagittarius
39+
--volume $(pwd)/container/sagittarius/sagittarius.yml:/sagittarius/config/sagittarius.yml
40+
$SAGITTARIUS_IMAGE
41+
$SAGITTARIUS_CMD &
42+
43+
container:boot:sagittarius:rails-web:
44+
extends:
45+
- .container:boot:sagittarius
46+
variables:
47+
SAGITTARIUS_CMD: ""
48+
script:
49+
- >
50+
docker run
51+
--rm
52+
--network boot
53+
$CURL_IMAGE
54+
curl
55+
--fail
56+
-sv
57+
--retry 20
58+
--retry-delay 3
59+
--retry-connrefused
60+
http://sagittarius:3000/health/liveness
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
.image-build-base:
2+
extends:
3+
- .dind
4+
image: ghcr.io/code0-tech/build-images/reticulum-builder:171.1-ruby-3.2.2
5+
stage: container
6+
script:
7+
- source scripts/helpers.sh
8+
- docker_login
9+
- 'image=$(echo "$CI_JOB_NAME" | cut -d : -f 2)'
10+
- '[ -z "$NEED_PROJECT_DOWNLOAD" ] || download_project $image'
11+
12+
.single-image-build-base:
13+
extends:
14+
- .image-build-base
15+
script:
16+
- !reference [.image-build-base, script]
17+
- build_image $image $CI_PIPELINE_ID
18+
- push_image $image $CI_PIPELINE_ID
19+
20+
.variant-image-build-base:
21+
extends:
22+
- .image-build-base
23+
script:
24+
- !reference [.image-build-base, script]
25+
- build_image $image $CI_PIPELINE_ID "--build-arg VARIANT=$VARIANT"
26+
- image_tag=$(get_image_tag $CI_PIPELINE_ID $VARIANT)
27+
- retag_image $image $CI_PIPELINE_ID $image_tag
28+
- push_image $image $image_tag
29+
30+
container:mise:
31+
extends:
32+
- .single-image-build-base
33+
34+
container:rust:
35+
extends:
36+
- .single-image-build-base
37+
needs:
38+
- container:mise
39+
40+
container:aquila:
41+
extends:
42+
- .single-image-build-base
43+
needs:
44+
- container:rust
45+
variables:
46+
NEED_PROJECT_DOWNLOAD: 'true'
47+
48+
container:draco:
49+
extends:
50+
- .variant-image-build-base
51+
needs:
52+
- container:rust
53+
variables:
54+
NEED_PROJECT_DOWNLOAD: 'true'
55+
parallel:
56+
matrix:
57+
- VARIANT:
58+
- rest
59+
60+
container:taurus:
61+
extends:
62+
- .single-image-build-base
63+
needs:
64+
- container:rust
65+
variables:
66+
NEED_PROJECT_DOWNLOAD: 'true'
67+
68+
container:ruby:
69+
extends:
70+
- .single-image-build-base
71+
needs:
72+
- container:mise
73+
74+
container:postgresql:
75+
extends:
76+
- .single-image-build-base
77+
needs:
78+
- container:mise
79+
80+
container:sagittarius:
81+
extends:
82+
- .variant-image-build-base
83+
needs:
84+
- container:ruby
85+
- container:postgresql
86+
variables:
87+
NEED_PROJECT_DOWNLOAD: 'true'
88+
parallel:
89+
matrix:
90+
- VARIANT:
91+
- ce
92+
- ee

container/sagittarius/Dockerfile.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ WORKDIR /sagittarius
1717
ENV RAILS_ENV="production" \
1818
BUNDLE_DEPLOYMENT="1" \
1919
BUNDLE_PATH="/usr/local/bundle" \
20-
BUNDLE_WITHOUT="development:test"
20+
BUNDLE_WITHOUT="development:test" \
21+
PATH="$PATH:/usr/local/share/postgres/bin"
2122

2223
# Install application gems
2324
COPY projects/sagittarius/Gemfile projects/sagittarius/Gemfile.lock ./
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rails:
2+
web:
3+
force_ssl: false
4+
db:
5+
host: postgres
6+
port: 5432

0 commit comments

Comments
 (0)