Compare commits

...

1 Commits

Author SHA1 Message Date
williamlardier ad2cf0f800
mongodb v4.2 2023-04-21 13:46:07 +02:00
4 changed files with 89 additions and 2 deletions

View File

@ -39,7 +39,7 @@ runs:
shell: bash
run: |
sudo apt-get install -y libdigest-hmac-perl
pip install virtualenv
pip install virtualenv==20.21.0
virtualenv -p $(which python2) ~/.virtualenv/py2
source ~/.virtualenv/py2/bin/activate
pip install 's3cmd==1.6.1'

View File

@ -73,7 +73,7 @@ services:
mongo:
network_mode: "host"
profiles: ['mongo', 'ceph']
image: scality/ci-mongo:3.6.8
image: ${MONGODB_IMAGE}
ceph:
network_mode: "host"
profiles: ['ceph']

58
.github/docker/mongodb/Dockerfile vendored Normal file
View File

@ -0,0 +1,58 @@
FROM mongo:4.2.24
ENV USER=scality \
HOME_DIR=/home/scality \
CONF_DIR=/conf \
DATA_DIR=/data
# Set up directories and permissions
RUN mkdir -p /data/db /data/configdb && chown -R mongodb:mongodb /data/db /data/configdb; \
mkdir /logs; \
adduser --uid 1000 --disabled-password --gecos --quiet --shell /bin/bash scality
# Set up environment variables and directories for scality user
RUN mkdir ${CONF_DIR} && \
chown -R ${USER} ${CONF_DIR} && \
chown -R ${USER} ${DATA_DIR}
# Create the mongod.conf file
RUN echo "storage:
journal:
enabled: true
engine: wiredTiger
dbPath: \"/data/db\"
processManagement:
fork: false
net:
port: 27018
bindIp: 0.0.0.0
replication:
replSetName: \"rs0\"
enableMajorityReadConcern: true
security:
authorization: disabled" > ${CONF_DIR}/mongod.conf
# Create the mongo-run.sh file
RUN echo "#!/bin/bash
set -exo pipefail
init_RS() {
sleep 5
mongo --port 27018 /conf/initReplicaSet.js
}
init_RS &
mongod --bind_ip_all --config=/conf/mongod.conf" > ${CONF_DIR}/mongo-run.sh && chmod +x ${CONF_DIR}/mongo-run.sh
# Create the initReplicaSet.js file
RUN echo "rs.initiate({
_id: \"rs0\",
members: [{ _id: 0, host: \"127.0.0.1:27018\" }]
});" > ${CONF_DIR}/initReplicaSet.js
EXPOSE 27017/tcp
EXPOSE 27018
# Set up CMD
ENTRYPOINT ["bash", "/conf/mongo-run.sh"]
CMD ["bash", "/conf/mongo-run.sh"]

View File

@ -153,6 +153,14 @@ jobs:
registry.scality.com/cloudserver-dev/cloudserver:${{ github.sha }}
cache-from: type=gha,scope=cloudserver
cache-to: type=gha,mode=max,scope=cloudserver
- name: Build and push MongoDB
uses: docker/build-push-action@v2
with:
push: true
context: .github/dockerfiles/mongodb
tags: ghcr.io/scality/${{ github.repository }}/ci-mongodb:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
multiple-backend:
runs-on: ubuntu-latest
@ -198,11 +206,18 @@ jobs:
S3KMS: file
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigTests.json
DEFAULT_BUCKET_KEY_FORMAT: v0
MONGODB_IMAGE: ghcr.io/scality/${{ github.repository }}/ci-mongodb:${{ github.sha }}
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}/cloudserver:${{ github.sha }}
JOB_NAME: ${{ github.job }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Scality Registry
uses: docker/login-action@v2
with:
registry: registry.scality.com
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Setup CI environment
uses: ./.github/actions/setup-ci
- name: Setup CI services
@ -237,11 +252,18 @@ jobs:
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigTests.json
DEFAULT_BUCKET_KEY_FORMAT: v1
METADATA_MAX_CACHED_BUCKETS: 1
MONGODB_IMAGE: ghcr.io/scality/${{ github.repository }}/ci-mongodb:${{ github.sha }}
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}/cloudserver:${{ github.sha }}
JOB_NAME: ${{ github.job }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Scality Registry
uses: docker/login-action@v2
with:
registry: registry.scality.com
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Setup CI environment
uses: ./.github/actions/setup-ci
- name: Setup CI services
@ -387,6 +409,7 @@ jobs:
CI_CEPH: 'true'
MPU_TESTING: "yes"
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigCeph.json
MONGODB_IMAGE: ghcr.io/scality/${{ github.repository }}/ci-mongodb:${{ github.sha }}
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}/cloudserver:${{ github.sha }}
JOB_NAME: ${{ github.job }}
steps:
@ -398,6 +421,12 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Scality Registry
uses: docker/login-action@v2
with:
registry: registry.scality.com
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Setup CI environment
uses: ./.github/actions/setup-ci
- uses: ruby/setup-ruby@v1