Skip to content

Commit 47d39eb

Browse files
jjmerchantesduenas
authored andcommitted
Update 2.x Dockerfile and docker-compose
Update Dockerfile and docker-compose files for version upgrades and configuration changes. Signed-off-by: Jose Javier Merchante <[email protected]>
1 parent b7ba9c6 commit 47d39eb

File tree

4 files changed

+47
-54
lines changed

4 files changed

+47
-54
lines changed

docker-compose/docker-compose-development.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '2.2'
2-
31
services:
42
mariadb:
53
image: mariadb:11.4
@@ -13,21 +11,22 @@ services:
1311
retries: 5
1412

1513
redis:
16-
image: redis:7.4
14+
image: redis:8
1715
ports:
1816
- "6379:6379"
1917
healthcheck:
2018
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
2119
retries: 5
2220

2321
opensearch-node1:
24-
image: opensearchproject/opensearch:2.11.1
22+
image: opensearchproject/opensearch:2.19.3
2523
environment:
2624
- cluster.name=opensearch-cluster
2725
- node.name=opensearch-node1
2826
- discovery.type=single-node
2927
- bootstrap.memory_lock=true
3028
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
29+
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=Admin-Password-1234
3130
ulimits:
3231
memlock:
3332
soft: -1
@@ -40,7 +39,7 @@ services:
4039
- 9600:9600
4140

4241
opensearch-dashboards:
43-
image: opensearchproject/opensearch-dashboards:2.11.1
42+
image: opensearchproject/opensearch-dashboards:2.19.3
4443
ports:
4544
- 5601:5601
4645
expose:

docker-compose/docker-compose.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '2.2'
2-
31
services:
42
mariadb:
53
image: mariadb:11.4
@@ -13,7 +11,7 @@ services:
1311
retries: 5
1412

1513
redis:
16-
image: redis:7.4
14+
image: redis:8
1715
expose:
1816
- "6379"
1917
healthcheck:
@@ -22,7 +20,7 @@ services:
2220

2321
grimoirelab_core:
2422
restart: on-failure:3
25-
image: grimoirelab/grimoirelab:dev
23+
image: grimoirelab/grimoirelab:2.x
2624
environment:
2725
GRIMOIRELAB_DB_HOST: mariadb
2826
GRIMOIRELAB_DB_PORT: 3306
@@ -32,8 +30,6 @@ services:
3230
GRIMOIRELAB_REDIS_HOST: redis
3331
GRIMOIRELAB_REDIS_PORT: 6379
3432
GRIMOIRELAB_REDIS_PASSWORD: ""
35-
GRIMOIRELAB_ARCHIVIST_WORKERS: 20
36-
GRIMOIRELAB_ARCHIVIST_STORAGE_URL: "https://admin:admin@opensearch-node1:9200"
3733
expose:
3834
- "9314"
3935
volumes:
@@ -43,11 +39,11 @@ services:
4339
condition: service_healthy
4440
redis:
4541
condition: service_healthy
46-
command: grimoirelab run server --clear-tasks
42+
command: grimoirelab run server
4743

4844
grimoirelab_core_eventizers:
4945
restart: on-failure:3
50-
image: grimoirelab/grimoirelab:dev
46+
image: grimoirelab/grimoirelab:2.x
5147
environment:
5248
GRIMOIRELAB_DB_HOST: mariadb
5349
GRIMOIRELAB_DB_PORT: 3306
@@ -57,7 +53,6 @@ services:
5753
GRIMOIRELAB_REDIS_HOST: redis
5854
GRIMOIRELAB_REDIS_PORT: 6379
5955
GRIMOIRELAB_REDIS_PASSWORD: ""
60-
GRIMOIRELAB_ARCHIVIST_WORKERS: 20
6156
depends_on:
6257
mariadb:
6358
condition: service_healthy
@@ -67,7 +62,7 @@ services:
6762

6863
grimoirelab_core_archivists:
6964
restart: on-failure:3
70-
image: grimoirelab/grimoirelab:dev
65+
image: grimoirelab/grimoirelab:2.x
7166
environment:
7267
GRIMOIRELAB_DB_HOST: mariadb
7368
GRIMOIRELAB_DB_PORT: 3306
@@ -77,7 +72,9 @@ services:
7772
GRIMOIRELAB_REDIS_HOST: redis
7873
GRIMOIRELAB_REDIS_PORT: 6379
7974
GRIMOIRELAB_REDIS_PASSWORD: ""
80-
GRIMOIRELAB_ARCHIVIST_WORKERS: 20
75+
GRIMOIRELAB_ARCHIVIST_STORAGE_URL: "https://opensearch-node1:9200"
76+
GRIMOIRELAB_ARCHIVIST_STORAGE_USERNAME: "admin"
77+
GRIMOIRELAB_ARCHIVIST_STORAGE_PASSWORD: "Admin-Password-1234"
8178
depends_on:
8279
mariadb:
8380
condition: service_healthy
@@ -106,7 +103,7 @@ services:
106103
expose:
107104
- "9314"
108105
volumes:
109-
- sortinghat-static:/opt/venv/lib/python3.9/site-packages/sortinghat/static/
106+
- sortinghat-static:/opt/venv/lib/python3.12/site-packages/sortinghat/static/
110107
depends_on:
111108
mariadb:
112109
condition: service_healthy
@@ -131,13 +128,14 @@ services:
131128
condition: service_healthy
132129

133130
opensearch-node1:
134-
image: opensearchproject/opensearch:2.11.1
131+
image: opensearchproject/opensearch:2.19.3
135132
environment:
136133
- cluster.name=opensearch-cluster
137134
- node.name=opensearch-node1
138135
- discovery.type=single-node
139136
- bootstrap.memory_lock=true
140137
- "OPENSEARCH_JAVA_OPTS=-Xms2g -Xmx2g"
138+
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=Admin-Password-1234
141139
ulimits:
142140
memlock:
143141
soft: -1
@@ -150,7 +148,7 @@ services:
150148
- 9600:9600
151149

152150
opensearch-dashboards:
153-
image: opensearchproject/opensearch-dashboards:2.11.1
151+
image: opensearchproject/opensearch-dashboards:2.19.3
154152
ports:
155153
- 5601:5601
156154
expose:

docker/Dockerfile

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
# Copyright (C) 2016-2022 Bitergia
22
# GPLv3 License
33

4-
FROM node:18 AS build-core-static
5-
6-
RUN git clone --depth 1 https://github.com/chaoss/grimoirelab-core.git
7-
8-
WORKDIR /grimoirelab-core/ui
9-
10-
RUN yarn install && yarn build
11-
12-
13-
FROM python:3.11-slim-bullseye
4+
FROM python:3.12-slim-bullseye
145

156
LABEL maintainer="Santiago Dueñas <[email protected]>"
167

17-
ENV DEBIAN_FRONTEND noninteractive
18-
ENV DEPLOY_USER grimoirelab
19-
ENV DEPLOY_USER_DIR /home/${DEPLOY_USER}
20-
ENV CONF_DIR ${DEPLOY_USER_DIR}/conf
21-
ENV SCRIPTS_DIR ${DEPLOY_USER_DIR}/scripts
22-
ENV GRIMOIRELAB_RELEASE "2.x"
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
ENV DEPLOY_USER=grimoirelab
10+
ENV DEPLOY_USER_DIR=/home/${DEPLOY_USER}
11+
ENV CONF_DIR=${DEPLOY_USER_DIR}/conf
12+
ENV SCRIPTS_DIR=${DEPLOY_USER_DIR}/scripts
13+
ENV GRIMOIRELAB_RELEASE="2.x"
2314

2415
# Create a user and a group
2516
RUN groupadd -r $DEPLOY_USER && useradd -r -m -g $DEPLOY_USER $DEPLOY_USER
@@ -32,9 +23,19 @@ RUN apt-get update && \
3223
git git-core \
3324
mariadb-client \
3425
libmariadbclient-dev-compat \
35-
unzip curl wget sudo ssh \
36-
&& \
37-
apt-get clean && \
26+
unzip curl wget sudo ssh
27+
28+
# Install nodejs
29+
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && \
30+
apt-get install -y nodejs
31+
32+
# Install yarn
33+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
34+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
35+
apt-get update && \
36+
apt-get install -y --no-install-recommends yarn
37+
38+
RUN apt-get clean && \
3839
find /var/lib/apt/lists -type f -delete
3940

4041
RUN echo "${DEPLOY_USER} ALL=NOPASSWD: ALL" >> /etc/sudoers
@@ -44,10 +45,10 @@ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
4445
dpkg-reconfigure --frontend=noninteractive locales && \
4546
update-locale LANG=en_US.UTF-8
4647

47-
ENV LANG en_US.UTF-8
48-
ENV LANGUAGE en_US:en
49-
ENV LC_ALL en_US.UTF-8
50-
ENV LANG C.UTF-8
48+
ENV LANG=en_US.UTF-8
49+
ENV LANGUAGE=en_US:en
50+
ENV LC_ALL=en_US.UTF-8
51+
ENV LANG=C.UTF-8
5152

5253
USER ${DEPLOY_USER}
5354

@@ -78,12 +79,11 @@ RUN python -m venv /opt/venv/ && \
7879
poetry update && \
7980
poetry install
8081

81-
COPY --from=build-core-static /grimoirelab-core/src/grimoirelab/core/templates/ /opt/venv/lib/python3.11/site-packages/grimoirelab/core/templates/
82-
8382
RUN chown -R $DEPLOY_USER:$DEPLOY_USER /opt/venv
8483

84+
# Make static files available in a known location
8585
RUN mkdir /core_static/
86-
COPY --from=build-core-static /grimoirelab-core/src/grimoirelab/core/templates/static/ /core_static/
86+
RUN cp -r /opt/venv/lib/python3.12/site-packages/grimoirelab/core/templates/static/. /core_static/
8787
RUN chown -R $DEPLOY_USER:$DEPLOY_USER /core_static/
8888

8989
COPY ./entrypoint.sh /usr/local/bin/

docker/entrypoint.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,16 @@ set -e
2424
export GRIMOIRELAB_CONFIG="${GRIMOIRELAB_CONFIG:-grimoirelab.core.config.settings}"
2525

2626
check_service() {
27-
django-admin check --settings=$GRIMOIRELAB_CONFIG --database default > /dev/null 2>&1
27+
django-admin check --settings="$GRIMOIRELAB_CONFIG" --database default > /dev/null 2>&1
2828
return $?
2929
}
3030

31-
# Only if the command is grimoirelab, setup the database
31+
# If running `grimoirelab run`, always ensure the database is up-to-date.
32+
# Otherwise, only set it up if the check fails.
3233
if [ "$1" = 'grimoirelab' ]; then
33-
if ! check_service ; then
34+
if [ "$2" = 'run' ] || ! check_service; then
3435
grimoirelab admin setup
35-
36-
if [ "$?" -ne "0" ]; then
37-
echo "GrimoireLab core setup failed."
38-
return 1
39-
fi
40-
fi
36+
fi
4137
fi
4238

4339
exec "$@"

0 commit comments

Comments
 (0)