Skip to content
This repository was archived by the owner on Jan 11, 2021. It is now read-only.

Commit a9ee50c

Browse files
authored
Merge pull request #1 from kksudo/develop
Release v.0.1.0
2 parents 582885b + b4ddbfc commit a9ee50c

12 files changed

+293
-2
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.*
2+
LICENSE
3+
VERSION
4+
README.md
5+
Changelog.md
6+
Makefile
7+
docker-compose.yml
8+
docs

.github/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OD_RELEASE=1.1
2+
OD_MASTER_COMMIT_ID=c3231634c4fe5d8c538c7442c136e7ec4ba0f983

.github/ISSUE_TEMPLATE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
### Problem description
2+
3+
<!--Briefly describe the problem that you found.
4+
Only DOCUMENTATION issues should be filed here.
5+
For general questions, go to https://forums.docker.com/. -->
6+
7+
### Problem location
8+
9+
<!-- Help us find the problem quickly by choosing one of these. -->
10+
11+
- I saw a problem on the following URL: <URL>
12+
13+
- I couldn't find the information I wanted. I expected to find it near the following URL: <URL>
14+
15+
- Other: <DETAILS>
16+
17+
### Project version(s) affected
18+
19+
<!-- If this problem only affects specific versions of a project (like Docker
20+
Engine 1.13), tell us here. The fix may need to take that into account. -->
21+
22+
### Suggestions for a fix
23+
24+
<!--If you have specific ideas about how we can fix this, let us know. -->
25+
26+
27+
<!-- To improve this template, edit the .github/ISSUE_TEMPLATE.md file -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
2+
for this project's contribution guidelines. Remove these comments
3+
as you go.
4+
5+
DO NOT edit files and directories listed in _data/not_edited_here.yaml.
6+
These are maintained in upstream repos and changes here will be lost.
7+
8+
Help us merge your changes more quickly by adding details and setting metadata
9+
(such as labels, milestones, and reviewers) over at the right-hand side.-->
10+
11+
### Proposed changes
12+
13+
<!--Tell us what you did and why-->
14+
15+
### Unreleased project version (optional)
16+
17+
<!--If this change only applies to an unreleased version of a project, note
18+
that here and base your work on the `vnext-` branch for your project. If
19+
this doesn't apply to this PR, you can remove this whole section.
20+
Set a milestone if appropriate. -->
21+
22+
### Related issues (optional)
23+
24+
<!--Refer to related PRs or issues: #1234, or 'Fixes #1234' or 'Closes #1234'.
25+
Or link to full URLs to issues or pull requests in other Github projects -->

.github/debug_workflow.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
steps:
2+
- name: ===DEBUG envs===
3+
run: |
4+
echo
5+
echo "❌ Useful icon for check fail step"
6+
echo "✅ Useful icon for check success step"
7+
echo "-- Environment variables ----------------------------------------------"
8+
env
9+
echo "-----------------------------------------------------------------------"
10+
- name: Setup tmate session
11+
uses: mxschmitt/action-tmate@v2
12+
# touch continue or sudo touch /continue to return job
13+
# GitHub workflow on local machine https://github.com/nektos/act

.github/workflows/build.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and push image
2+
3+
on:
4+
repository_dispatch:
5+
types: [release,master]
6+
env:
7+
USER: "kksudo"
8+
DOCKER_IMAGE: "odyssey-docker"
9+
ODYSSEY_GIT_REPO: "yandex/odyssey"
10+
ODYSSEY_MAIN_BRANCH: "master"
11+
DOCKER_REG_GIT: "docker.pkg.github.com"
12+
DOCKER_REPO_GIT: "odyssey-docker/odyssey"
13+
LOCAL_ENV_PATH: ".github/.env"
14+
15+
jobs:
16+
# Add DockerLint Job and validate
17+
buildImage:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repo
21+
uses: actions/checkout@master
22+
- name: Login to gitHub docker registry and pull latest image
23+
run: |
24+
docker login ${DOCKER_REG_GIT} -u ${USER} -p ${{secrets.GH_TOKEN}}
25+
docker pull ${DOCKER_REG_GIT}/${USER}/${DOCKER_REPO_GIT}:develop
26+
- name: Build from new tag
27+
if: ${{ github.event.client_payload.tag }}
28+
run: |
29+
echo "::set-env name=COMMIT_TYPE::${{ github.event.client_payload.tag }}"
30+
echo "New tag=>${{ github.event.client_payload.id }}"
31+
docker build --build-arg ODYSSEY_VERSION=${{ github.event.client_payload.id }} \
32+
-t ${DOCKER_IMAGE}:CI_${GITHUB_RUN_NUMBER} .
33+
- name: Build from latest commit ID
34+
if: ${{ github.event.client_payload.commit }}
35+
run: |
36+
echo "::set-env name=COMMIT_TYPE::$(echo $ODYSSEY_MAIN_BRANCH)"
37+
echo "New latest master commit_id=>${{ github.event.client_payload.id }}"
38+
docker build --build-arg ODYSSEY_VERSION=${ODYSSEY_MAIN_BRANCH} \
39+
-t ${DOCKER_IMAGE}:CI_${GITHUB_RUN_NUMBER} .
40+
- name: Add docker tags and push to GitHub Packages
41+
run: |
42+
TAGS=(develop latest $COMMIT_TYPE ${{ github.event.client_payload.id }} CI_${GITHUB_RUN_NUMBER})
43+
for tag in ${TAGS[*]}
44+
do
45+
docker tag ${DOCKER_IMAGE}:CI_${GITHUB_RUN_NUMBER} ${DOCKER_REG_GIT}/${USER}/${DOCKER_REPO_GIT}:$tag
46+
docker push ${DOCKER_REG_GIT}/${USER}/${DOCKER_REPO_GIT}:$tag
47+
done
48+
- name: Write latest commit to .env
49+
run: |
50+
if [ ${{ github.event.client_payload.tag }} ]
51+
then
52+
sed -i -E "s/(OD_RELEASE=).*$/\1${{ github.event.client_payload.id }}/" $LOCAL_ENV_PATH
53+
elif [ ${{ github.event.client_payload.commit }} ]
54+
then
55+
sed -i -E "s/(OD_MASTER_COMMIT_ID=).*$/\1${{ github.event.client_payload.id }}/" $LOCAL_ENV_PATH
56+
fi
57+
- name: Push latest vars to git
58+
uses: EndBug/add-and-commit@v4
59+
with:
60+
add: ${{env.LOCAL_ENV_PATH}}
61+
author_name: Github actions
62+
author_email: [email protected]
63+
message: "CI_BOT:Image baked:Latest image is ${{ github.event.client_payload.id }}"
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Watching remote repo
2+
3+
on:
4+
schedule:
5+
- cron: '07 * * * *'
6+
push:
7+
branches:
8+
- develop
9+
paths-ignore:
10+
- ".github/.env"
11+
env:
12+
USER: "kksudo"
13+
ODYSSEY_GIT_REPO: "yandex/odyssey"
14+
LOCAL_ENV_PATH: ".github/.env"
15+
jobs:
16+
watch-repo:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repo
20+
uses: actions/checkout@master
21+
- name: Get the latest up-to-date data from a remote repository
22+
id: get_remote_vars
23+
run: |
24+
echo ::set-env name=LATEST_REMOTE_RELEASE::$(echo $(curl --silent https://api.github.com/repos/${ODYSSEY_GIT_REPO}/releases/latest | grep '"tag_name":' | cut -d'"' -f4))
25+
echo ::set-env name=LATEST_REMOTE_MASTER_COMMIT_ID::$(echo $(git ls-remote git://github.com/${ODYSSEY_GIT_REPO}.git HEAD | awk '{ print $1}'))
26+
- name: Get the local vars from .env
27+
id: get_local_vars
28+
uses: falti/[email protected]
29+
with:
30+
path: ${{ env.LOCAL_ENV_PATH }}
31+
- name: The official LATEST_RELEASE has been updated
32+
if: env.LATEST_REMOTE_RELEASE != steps.get_local_vars.outputs.od_release
33+
uses: peter-evans/repository-dispatch@v1
34+
with:
35+
token: ${{ secrets.GH_TOKEN }}
36+
event-type: release
37+
client-payload: '{"id": "${{ env.LATEST_REMOTE_MASTER_COMMIT_ID }}", "tag": "true"}'
38+
- name: The official MASTER branch has been updated
39+
if: env.LATEST_REMOTE_MASTER_COMMIT_ID != steps.get_local_vars.outputs.od_master_commit_id
40+
uses: peter-evans/repository-dispatch@v1
41+
with:
42+
token: ${{ secrets.GH_TOKEN }}
43+
event-type: master
44+
client-payload: '{"id": "${{ env.LATEST_REMOTE_MASTER_COMMIT_ID }}", "commit": "true"}'
45+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
FROM ubuntu:focal as builder
2+
3+
ARG ODYSSEY_VERSION=1.1
4+
ENV DEBIAN_FRONTEND noninteractive
5+
6+
WORKDIR /tmp/
7+
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
curl \
10+
ca-certificates \
11+
gnupg \
12+
lsb-release \
13+
git
14+
15+
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
16+
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
17+
18+
RUN apt-get update && apt-get install -y --no-install-recommends \
19+
build-essential \
20+
cmake \
21+
gcc \
22+
gdb \
23+
libpam0g-dev \
24+
libssl-dev \
25+
postgresql-server-dev-11 \
26+
valgrind
27+
28+
RUN git clone --branch ${ODYSSEY_VERSION} --depth 1 git://github.com/yandex/odyssey.git \
29+
&& cd odyssey \
30+
&& mkdir build \
31+
&& cd build \
32+
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
33+
&& make
34+
35+
WORKDIR /tmp/odyssey
36+
RUN cat odyssey.conf | grep -v -E '^(#.*|)$' > build/sources/odyssey-slim.conf
37+
38+
39+
FROM ubuntu:focal
40+
41+
RUN apt-get update && apt-get install -y --no-install-recommends \
42+
libssl1.1 \
43+
&& apt-get clean
44+
45+
RUN groupadd -r odyssey && useradd -r -g odyssey odyssey
46+
47+
COPY --from=builder /tmp/odyssey/build/sources/odyssey /usr/local/bin/
48+
COPY --from=builder /tmp/odyssey/build/sources/odyssey-slim.conf /etc/odyssey/odyssey.conf
49+
50+
COPY docker-entrypoint.sh /entrypoint.sh
51+
52+
RUN chmod a+x /entrypoint.sh
53+
USER odyssey
54+
ENTRYPOINT ["/entrypoint.sh"]
55+
56+
EXPOSE 5432
57+
CMD ["odyssey"]

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
1-
# odyssey-docker
2-
Automated docker builds for github.com/yandex/odyssey
1+
<p align="center">
2+
<img src="logo.png" width="35%" height="35%" /><br>
3+
</p>
4+
<br>
5+
6+
Project status
7+
--------------
8+
9+
Warning: The project is under development.
10+
![master-build](https://github.com/kksudo/odyssey-docker/workflows/master-build/badge.svg?branch=develop)
11+
12+
# Odyssey
13+
Advanced multi-threaded [PostgreSQL](https://www.postgresql.org/) connection pooler and request router.
14+
15+
Odyssey Docker image
16+
======================
17+
18+
Automated docker builds for [yandex/odyssey](https://github.com/yandex/odyssey).
19+
This is a minimal Odyssey image ( [DockerHub](https://hub.docker.com/r/kksudo/odyssey-docker) or [Github packages](https://github.com/kksudo/odyssey-docker/packages/) ), based on Ubuntu Focal.
20+
21+
Features:
22+
23+
* Uses standard Postgres port 5432, to work transparently for applications.
24+
* `/etc/odyssey/odyssey.conf` is auto-created if it don't exist.
25+
26+
27+
Available tags
28+
--------------
29+
30+
Stable tags:
31+
32+
- `1.1` - Image from latest tag in [yandex/odyssey](https://github.com/yandex/odyssey). Latest stable version.
33+
- `master` - Image from latest master branch in [yandex/odyssey](https://github.com/yandex/odyssey). Latest develop version.
34+
- `<commit_id>` - Same as master, but tagged with commit_id.
35+
36+
Tags for development, do not use them.
37+
38+
- `latest` - Latest build in CI.
39+
- `develop` - Latest debug build.

0 commit comments

Comments
 (0)