Skip to content

Commit

Permalink
Merge pull request #70 from kartoza/upgrade
Browse files Browse the repository at this point in the history
Update configs and version
  • Loading branch information
NyakudyaA authored Dec 23, 2024
2 parents cec9d8f + dd0c5c7 commit c44137d
Show file tree
Hide file tree
Showing 15 changed files with 326 additions and 267 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/build-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,37 @@ on:
pull_request:
branches:
- main
- action
- master
paths:
- 'Dockerfile'
- 'scripts/**'
- 'build_data/**'
- '.github/workflows/**'
push:
branches:
- develop
- master
- main
paths:
- 'Dockerfile'
- 'scripts/**'
- 'build_data/**'
- '.github/workflows/**'

jobs:
run-scenario-tests:
if: |
github.actor != 'dependabot[bot]' &&
!(
contains(github.event.pull_request.title, '[skip-release]') ||
contains(github.event.comment.body, '/skiprelease')
)
runs-on: ubuntu-latest
strategy:
matrix:
mapproxy_version:
- '==1.16.0'
- '==3.1.3'
imageVersion:
- image: 3.11.5
- image: 3.13.0
scenario:
- s3
- proxy
Expand Down Expand Up @@ -58,15 +75,22 @@ jobs:
bash ./test.sh
push-internal-pr-images:
if: github.event_name == 'pull_request' && github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url &&
github.actor != 'dependabot[bot]' &&
!(
contains(github.event.pull_request.title, '[skip-release]') ||
contains(github.event.comment.body, '/skiprelease')
)
runs-on: ubuntu-latest
needs: [ run-scenario-tests ]
strategy:
matrix:
mapproxy_version:
- '==1.16.0'
- '==3.1.3'
imageVersion:
- image: 3.11.5
- image: 3.13.0
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/build-push-image.yaml

This file was deleted.

91 changes: 77 additions & 14 deletions .github/workflows/deploy-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@ on:
workflows:
- build-latest
branches:
- develop
- action
- master
- main
types:
- completed
jobs:
deploy-image:
if: |
github.actor != 'dependabot[bot]' &&
!(
contains(github.event.pull_request.title, '[skip-release]') ||
contains(github.event.comment.body, '/skiprelease')
) && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
env:
latest-ref: refs/heads/develop
strategy:
matrix:
mapproxy_version:
- '==1.16.0'
- '==3.1.3'
imageVersion:
- image: 3.11.5
- image: 3.13.0
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
Expand All @@ -35,21 +41,30 @@ jobs:

- name: Get Current Date
id: current_date
shell: python
run: |
import datetime
now = datetime.datetime.utcnow()
print(f'::set-output name=formatted::{now:%Y.%m.%d}')
run: echo "formatted=$(date -u +%Y.%m.%d)" >> $GITHUB_OUTPUT

- name: Replace '=='
id: replace_double_equals
- name: Format Version Name
id: format_version_name
run: |
mapproxy_version="${{ matrix.mapproxy_version }}"
mapproxy_version="${mapproxy_version//==/}"
echo "::set-env name=formatted_mapproxy_version::$mapproxy_version"
echo "formatted_mapproxy_version=$mapproxy_version" >> $GITHUB_OUTPUT
shell: bash

- name: Check if image exists on Docker Hub
id: check_hub_image_exists
run: |
docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password ${{ secrets.DOCKERHUB_PASSWORD }}
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.DOCKERHUB_PASSWORD }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
check_image=$(curl --silent -f --head -lL https://hub.docker.com/v2/repositories/kartoza/mapproxy/tags/${{ steps.format_version_name.outputs.formatted_mapproxy_version }}/ | head -n 1 | cut -d ' ' -f2) >> $GITHUB_OUTPUT
- name: Build prod image
if: |
github.actor != 'dependabot[bot]' &&
!(
contains(github.event.pull_request.title, '[skip-release]') ||
contains(github.event.comment.body, '/skiprelease')
) && github.event.workflow_run.conclusion == 'success'
id: docker_build_prod
uses: docker/build-push-action@v4
with:
Expand All @@ -59,11 +74,59 @@ jobs:
push: true
tags: |
${{ secrets.DOCKERHUB_REPO }}/mapproxy
${{ secrets.DOCKERHUB_REPO }}/mapproxy:${{ env.formatted_mapproxy_version }}
${{ steps.check_hub_image_exists.outputs.check_image == 200 && format('{0}/mapproxy:{1}', secrets.DOCKERHUB_REPO, steps.format_version_name.outputs.formatted_mapproxy_version) || null}}
${{ secrets.DOCKERHUB_REPO }}/mapproxy:${{ steps.format_version_name.outputs.formatted_mapproxy_version }}
${{ secrets.DOCKERHUB_REPO }}/mapproxy:${{ steps.format_version_name.outputs.formatted_mapproxy_version }}--v${{ steps.current_date.outputs.formatted }}
build-args: |
IMAGE_VERSION=${{ matrix.imageVersion.image }}
MAPPROXY_VERSION=${{ env.formatted_mapproxy_version }}
MAPPROXY_VERSION=${{ matrix.mapproxy_version }}
cache-from: |
type=gha,scope=test
type=gha,scope=prod
cache-to: type=gha,scope=prod

publish_release_artifacts:
runs-on: ubuntu-latest
timeout-minutes: 5
if: |
github.actor != 'dependabot[bot]' &&
!(
contains(github.event.pull_request.title, '[skip-release]') ||
contains(github.event.comment.body, '/skiprelease')
) && github.event.workflow_run.conclusion == 'success'
needs: [ deploy-image ]
strategy:
matrix:
mapproxy_version:
- '==3.1.3'
imageVersion:
- image: 3.13.0
steps:
- name: Checkout code
id: git_checkout
uses: actions/checkout@v4
with:
ref: 'master'

- name: Get Current Date
id: current_date
run: echo "formatted=$(date -u +%Y.%m.%d)" >> $GITHUB_OUTPUT

- name: Format Version Name
id: format_version_name
run: |
mapproxy_version="${{ matrix.mapproxy_version }}"
mapproxy_version="${mapproxy_version//==/}"
echo "formatted_mapproxy_version=$mapproxy_version" >> $GITHUB_OUTPUT
shell: bash

- name: Get Latest Commit Hash
id: latest_commit_hash
run: echo "commit=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT

- name: publish_release
id: tag_releases
run: |
gh release create v${{ steps.format_version_name.outputs.formatted_mapproxy_version }}--${{ steps.current_date.outputs.formatted }}--${{ steps.latest_commit_hash.outputs.commit }} --notes ${{ steps.latest_commit_hash.outputs.commit }} --target master --repo $GITHUB_REPOSITORY
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 12 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
ARG IMAGE_VERSION=3.11.5
ARG IMAGE_VERSION=3.13.0
FROM python:${IMAGE_VERSION}
MAINTAINER Tim Sutton<[email protected]>

Expand All @@ -9,24 +9,29 @@ ARG MAPPROXY_VERSION=''
RUN apt-get -y update && \
apt-get install -y \
gettext \
python3-yaml \
libgeos-dev \
python3-lxml \
libgdal-dev \
build-essential \
python3-dev \
libjpeg-dev \
libgeos-dev \
zlib1g-dev \
libfreetype6-dev \
python3-dev \
python3-lxml \
python3-yaml \
python3-virtualenv \
python3-pil \
python3-pyproj \
python3-shapely \
figlet \
gosu awscli; \
# verify that the binary works
gosu nobody true
RUN pip3 --disable-pip-version-check install Shapely Pillow MapProxy${MAPPROXY_VERSION} uwsgi pyproj boto3 s3cmd \
requests riak==2.4.2 redis numpy

RUN ln -s /usr/lib/libgdal.a /usr/lib/liblibgdal.a
ADD build_data/requirements_template.txt /settings/requirements_template.txt
RUN export MAPPROXY_VERSION=${MAPPROXY_VERSION} && envsubst < /settings/requirements_template.txt > /settings/requirements.txt
RUN pip3 --disable-pip-version-check install -r /settings/requirements.txt


# Cleanup resources
RUN apt-get -y --purge autoremove \
Expand All @@ -42,4 +47,3 @@ RUN chmod +x /scripts/*.sh
RUN echo 'figlet -t "Kartoza Docker MapProxy"' >> ~/.bashrc

ENTRYPOINT [ "/scripts/start.sh" ]
CMD [ "/scripts/run_develop_server.sh" ]
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ The image specifies a couple of environment variables
* `CHEAPER=`Minimum number of workers allowed. This should always be lower than
the env `PROCESSES`
* `THREADS`=maximum number of parallel threads to run production instance with.
* `PRODUCTION`=Boolean value to indicate if you need to run develop server or using uwsgi
* `MULTI_MAPPROXY`=Boolean value to indicate if you need to run multi mapproxy. Defaults to false
* `ALLOW_LISTING`=Allows listing all config files in multi map mode
* `LOGGING`=Boolean value to indicate if you need to activate logging. Useful
Expand Down
12 changes: 12 additions & 0 deletions build_data/requirements_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Shapely
Pillow
MapProxy${MAPPROXY_VERSION}
uwsgi
pyproj
boto3
s3cmd
requests
riak==2.4.2
redis
numpy
azure-storage-blob
4 changes: 1 addition & 3 deletions docker-compose-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

volumes:
mapproxy_cache_data:

Expand All @@ -11,7 +9,7 @@ services:
context: .
args:
MAPPROXY_VERSION: ''
IMAGE_VERSION: '3.11.5'
IMAGE_VERSION: '3.13.0'
volumes:
# If MULTI_MAPPROXY=true then mount to /multi_mapproxy otherwise mount to /mapproxy
- ./mapproxy_configuration:/multi_mapproxy
Expand Down
1 change: 0 additions & 1 deletion docker-compose-s3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.9'

volumes:
minio_data:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.9'
volumes:
mapproxy_cache_data:
services:
Expand Down
1 change: 0 additions & 1 deletion scenario_tests/multi_proxy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.9'

services:
map:
Expand Down
1 change: 0 additions & 1 deletion scenario_tests/proxy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.9'

services:
map:
Expand Down
2 changes: 0 additions & 2 deletions scenario_tests/s3/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

volumes:
minio_data:
services:
Expand Down
5 changes: 3 additions & 2 deletions scripts/env-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ fi
if [ -z "${THREADS}" ]; then
THREADS=10
fi
if [ -z "${PRODUCTION}" ]; then
PRODUCTION=true
if [ -z "${PRESERVE_EXAMPLE_CONFIGS}" ]; then
PRESERVE_EXAMPLE_CONFIGS=false
fi

if [ -z "${MAPPROXY_APP_DIR}" ]; then
MAPPROXY_APP_DIR=/opt/mapproxy
fi
Expand Down
11 changes: 0 additions & 11 deletions scripts/run_develop_server.sh

This file was deleted.

Loading

0 comments on commit c44137d

Please sign in to comment.