Skip to content

Commit a434aa0

Browse files
committed
Revert "Merge branch 'master' into 'release-0.9.0'"
This reverts commit 6f44ef6
1 parent 6f44ef6 commit a434aa0

23 files changed

+175
-794
lines changed

.gitlab-ci.yml

+105-17
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,121 @@ include:
1111
- project: 'redmic-project/gitlab-ci-templates'
1212
ref: master
1313
file: '/deployment.yml'
14+
- project: 'redmic-project/gitlab-ci-templates'
15+
ref: master
16+
file: '/deployment-custom-image.yml'
1417

1518
stages:
1619
- build
1720
- license-list
21+
- pre-package
1822
- package
19-
- test-package
23+
- post-package
2024
- deploy
2125

2226
variables:
23-
LOGGING_LEVEL_ROOT: error
24-
LOGGING_LEVEL_ORG_SPRINGFRAMEWORK: error
25-
DOCKER_BUILD_ARGS: --build-arg PARENT_IMAGE_NAME=${REDMIC_SERVER_IMAGE_NAME} --build-arg PARENT_IMAGE_TAG=${REDMIC_SERVER_IMAGE_TAG}
26-
STACK: socket
27+
PROJECT_PARENT_NAME: socket
2728

28-
.deploy:
29-
script:
30-
- >
31-
deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} COMPOSE_FILE=${COMPOSE_FILE}
32-
SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE} OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID}
33-
OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET} PUBLIC_HOSTNAME=${PUBLIC_HOSTNAME}
34-
environment:
35-
url: https://${PUBLIC_HOSTNAME}/api/${CI_PROJECT_NAME}
29+
.docker-build:
30+
variables:
31+
DBLD_PARENT_IMAGE_NAME: ${REDMIC_SERVER_IMAGE_NAME}
32+
DBLD_PARENT_IMAGE_TAG: ${REDMIC_SERVER_IMAGE_TAG}
3633

37-
.deploy-development:
34+
.maven-build:
3835
variables:
39-
SPRING_PROFILES_ACTIVE: pre
36+
POSTGRES_IMAGE_TAG: 10.13-alpine
37+
POSTGRES_DB: redmic
38+
POSTGRES_USER: postgres
39+
POSTGRES_PASSWORD: password
40+
OAUTH_IMAGE_NAME: registry.gitlab.com/redmic-project/server/oauth/master
41+
OAUTH_IMAGE_TAG: latest
42+
OAUTH_CLIENT_ID: oauth_id
43+
OAUTH_CLIENT_SECRET: oauth_secret
44+
DIND_IMAGE_NAME: docker
45+
DIND_IMAGE_TAG: dind
46+
DOCKER_HOST: tcp://docker:2375
47+
OAUTH_SERVER: http://docker:8081
48+
SPRING_DATASOURCE_URL: jdbc:postgresql://docker:5432/redmic?stringtype=unspecified
49+
GITLAB_REGISTRY_HOST: registry.gitlab.com
50+
CI_DEPLOY_USER: ci_deploy_user
51+
CI_DEPLOY_PASSWORD: ci_deploy_password
52+
LOGGING_LEVEL_ROOT: error
53+
LOGGING_LEVEL_ORG_SPRINGFRAMEWORK: error
54+
services:
55+
- ${DIND_IMAGE_NAME}:${DIND_IMAGE_TAG}
56+
before_script:
57+
- >
58+
mkdir -p sql;
59+
chmod -R 755 sql;
60+
docker network create test
61+
- >
62+
docker run -d --rm --name postgres \
63+
-p 5432:5432 \
64+
--network test \
65+
--network-alias db \
66+
-e POSTGRES_DB \
67+
-e POSTGRES_USER \
68+
-e POSTGRES_PASSWORD \
69+
-v $(pwd)/sql:/sql \
70+
postgres:${POSTGRES_IMAGE_TAG}
71+
- >
72+
curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN_READ_API}" \
73+
-o sql/oauth_database_structure_test.sql \
74+
"https://gitlab.com/api/v4/snippets/${OAUTH_DATABASE_STRUCTURE_TEST_SNIPPET_ID}/raw";
75+
curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN_READ_API}" \
76+
-o sql/oauth_database_data_test.sql \
77+
"https://gitlab.com/api/v4/snippets/${OAUTH_DATABASE_DATA_TEST_SNIPPET_ID}/raw";
78+
curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN_READ_API}" \
79+
-o sql/user_database_structure_test.sql \
80+
"https://gitlab.com/api/v4/snippets/${USER_DATABASE_STRUCTURE_TEST_SNIPPET_ID}/raw";
81+
curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN_READ_API}" \
82+
-o sql/user_database_data_test.sql \
83+
"https://gitlab.com/api/v4/snippets/${USER_DATABASE_DATA_TEST_SNIPPET_ID}/raw"
84+
- >
85+
RETRIES=10;
86+
until docker exec postgres psql -h localhost \
87+
-d redmic \
88+
-U ${POSTGRES_USER} \
89+
-c 'select 1' > /dev/null 2>&1 || [ $RETRIES -eq 0 ];
90+
do
91+
RETRIES=$((RETRIES-=1));
92+
echo "Waiting for postgres server, ${RETRIES} remaining attempts...";
93+
sleep 1;
94+
done;
95+
docker exec postgres psql -h localhost \
96+
-d redmic \
97+
-U ${POSTGRES_USER} \
98+
-f /sql/oauth_database_structure_test.sql;
99+
docker exec postgres psql -h localhost \
100+
-d redmic \
101+
-U ${POSTGRES_USER} \
102+
-c "ALTER ROLE ${USER_SPRING_DATASOURCE_USERNAME} WITH PASSWORD '${USER_SPRING_DATASOURCE_PASSWORD}'";
103+
docker exec postgres psql -h localhost \
104+
-d redmic \
105+
-U ${POSTGRES_USER} \
106+
-f /sql/oauth_database_data_test.sql;
107+
docker exec postgres psql -h localhost \
108+
-d redmic \
109+
-U ${POSTGRES_USER} \
110+
-f /sql/user_database_structure_test.sql;
111+
docker exec postgres psql -h localhost \
112+
-d redmic \
113+
-U ${POSTGRES_USER} \
114+
-f /sql/user_database_data_test.sql
115+
- >
116+
docker run -d --rm --name oauth \
117+
-p 8081:8081 \
118+
--network test \
119+
-e SPRING_PROFILES_ACTIVE=dev \
120+
-e SPRING_DATASOURCE_USERNAME=${USER_SPRING_DATASOURCE_USERNAME} \
121+
-e SPRING_DATASOURCE_PASSWORD=${USER_SPRING_DATASOURCE_PASSWORD} \
122+
${OAUTH_IMAGE_NAME}:${OAUTH_IMAGE_TAG}
123+
after_script:
124+
- rm -rf .m2/repository/es
125+
- docker stop oauth postgres
40126

41-
.deploy-production:
127+
.deploy:
42128
variables:
43-
SPRING_PROFILES_ACTIVE: prod
129+
STACK: ${PROJECT_PARENT_NAME}
130+
environment:
131+
url: https://${PUBLIC_HOSTNAME}/api/${CI_PROJECT_NAME}

Dockerfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
ARG PARENT_IMAGE_NAME
2-
ARG PARENT_IMAGE_TAG
1+
ARG PARENT_IMAGE_NAME=registry.gitlab.com/redmic-project/docker/redmic-server
2+
ARG PARENT_IMAGE_TAG=latest
33

44
FROM ${PARENT_IMAGE_NAME}:${PARENT_IMAGE_TAG}
55

66
COPY /dist/*.jar ./
77

8+
ARG MICROSERVICE_NAME=socket
9+
ENV MICROSERVICE_NAME=${MICROSERVICE_NAME}
10+
11+
ARG MICROSERVICE_PORT=8089
12+
ENV MICROSERVICE_PORT=${MICROSERVICE_PORT}
13+
814
EXPOSE ${MICROSERVICE_PORT}

deploy/.env

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
PARENT_IMAGE_NAME=registry.gitlab.com/redmic-project/docker/redmic-server
2+
PARENT_IMAGE_TAG=latest
3+
14
MICROSERVICE_NAME=socket
25
MICROSERVICE_PORT=8089

deploy/docker-compose.dev.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@ version: '3.5'
22

33
services:
44
socket:
5-
ports:
6-
- target: ${MICROSERVICE_PORT}
7-
published: ${MICROSERVICE_PORT}
8-
mode: host
5+
environment:
6+
SPRING_PROFILES_ACTIVE: pre

deploy/docker-compose.prod.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@ version: '3.5'
22

33
services:
44
socket:
5-
deploy:
6-
placement:
7-
constraints:
8-
- node.role == worker
5+
environment:
6+
SPRING_PROFILES_ACTIVE: prod

deploy/docker-compose.tmpl.yml

+35-20
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,62 @@ version: '3.5'
22

33
services:
44
socket:
5-
image: ${IMAGE_NAME}:${IMAGE_TAG:-latest}
5+
image: ${IMAGE_NAME:-registry.gitlab.com/redmic-project/server/socket}:${IMAGE_TAG:-latest}
6+
build:
7+
context: ..
8+
dockerfile: ${DOCKERFILE:-Dockerfile}
9+
args:
10+
PARENT_IMAGE_NAME:
11+
PARENT_IMAGE_TAG:
12+
MICROSERVICE_NAME:
13+
MICROSERVICE_PORT:
614
environment:
7-
- MICROSERVICE_NAME
8-
- MICROSERVICE_PORT
9-
- SPRING_PROFILES_ACTIVE
10-
- OAUTH_CLIENT_ID
11-
- OAUTH_CLIENT_SECRET
12-
- JAVA_OPTS=-XX:MaxRAMFraction=2
15+
MICROSERVICE_NAME:
16+
MICROSERVICE_PORT:
17+
OAUTH_CLIENT_ID:
18+
OAUTH_CLIENT_SECRET:
19+
JAVA_OPTS: -XX:MaxRAMFraction=2
1320
networks:
14-
- kafka-net
15-
- redmic-net
16-
- traefik-net
21+
kafka-net:
22+
redmic-net:
23+
traefik-net:
1724
healthcheck:
1825
test: wget --spider -q http://localhost:${MICROSERVICE_PORT}/api/${MICROSERVICE_NAME}/actuator/health
19-
interval: 30s
20-
timeout: 10s
21-
retries: 3
22-
start_period: 3m
26+
interval: ${HEALTHCHECK_INTERVAL:-30s}
27+
timeout: ${HEALTHCHECK_TIMEOUT:-10s}
28+
retries: ${HEALTHCHECK_RETRIES:-3}
29+
start_period: ${HEALTHCHECK_START_PERIOD:-3m}
2330
deploy:
2431
mode: replicated
25-
replicas: 1
32+
replicas: ${REPLICAS:-1}
2633
labels:
2734
traefik.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/api/${MICROSERVICE_NAME};ReplacePathRegex:^(/api/${MICROSERVICE_NAME})/(info|[0-9]+/.*)$$ $$1/msg/$$2
2835
traefik.backend: ${MICROSERVICE_NAME}
2936
traefik.port: "${MICROSERVICE_PORT}"
3037
restart_policy:
31-
delay: 1m
32-
window: 3m
38+
delay: ${RESTART_DELAY:-1m}
39+
update_config:
40+
delay: ${UPDATE_DELAY:-2m}
3341
resources:
3442
limits:
35-
cpus: '0.5'
36-
memory: 512M
43+
cpus: '${RESOURCES_LIMITS_CPUS:-0.5}'
44+
memory: ${RESOURCES_LIMITS_MEMORY:-512M}
3745
reservations:
38-
memory: 410M
46+
cpus: '${RESOURCES_RESERVATIONS_CPUS:-0.001}'
47+
memory: ${RESOURCES_RESERVATIONS_MEMORY:-410M}
3948

4049
networks:
4150
kafka-net:
51+
name: ${KAFKA_NET_NAME:-kafka-net}
52+
driver: ${KAFKA_NET_DRIVER:-overlay}
4253
external: true
4354

4455
redmic-net:
56+
name: ${REDMIC_NET_NAME:-redmic-net}
57+
driver: ${REDMIC_NET_DRIVER:-overlay}
4558
external: true
4659

4760
traefik-net:
61+
name: ${TRAEFIK_NET_NAME:-traefik-net}
62+
driver: ${TRAEFIK_NET_DRIVER:-overlay}
4863
external: true

pom.xml

+5-34
Original file line numberDiff line numberDiff line change
@@ -125,45 +125,16 @@
125125
<scope>test</scope>
126126
</dependency>
127127
</dependencies>
128-
<repositories>
129-
<repository>
130-
<id>central</id>
131-
<name>libs-release</name>
132-
<url>https://artifactory.redmic.net/artifactory/libs-release</url>
133-
</repository>
134-
<repository>
135-
<id>snapshots</id>
136-
<name>libs-snapshot</name>
137-
<url>https://artifactory.redmic.net/artifactory/libs-snapshot</url>
138-
</repository>
139-
<repository>
140-
<id>osgeo</id>
141-
<name>Open Source Geospatial Foundation Repository</name>
142-
<url>http://download.osgeo.org/webdav/geotools/</url>
143-
</repository>
144-
<repository>
145-
<id>confluent</id>
146-
<name>Confluent</name>
147-
<url>https://packages.confluent.io/maven/</url>
148-
</repository>
149-
</repositories>
150128
<build>
151129
<plugins>
152130
<plugin>
153131
<groupId>org.springframework.boot</groupId>
154132
<artifactId>spring-boot-maven-plugin</artifactId>
155-
<executions>
156-
<execution>
157-
<goals>
158-
<goal>repackage</goal>
159-
</goals>
160-
<configuration>
161-
<executable>true</executable>
162-
<finalName>socket</finalName>
163-
<outputDirectory>dist</outputDirectory>
164-
</configuration>
165-
</execution>
166-
</executions>
133+
<configuration>
134+
<executable>true</executable>
135+
<finalName>socket</finalName>
136+
<outputDirectory>dist</outputDirectory>
137+
</configuration>
167138
</plugin>
168139
<plugin>
169140
<groupId>org.apache.maven.plugins</groupId>

src/main/java/es/redmic/socket/ingest/geodata/area/IngestDataAreaController.java

-60
This file was deleted.

0 commit comments

Comments
 (0)