Commit 3133c283 authored by ale's avatar ale

Initial commit

parents
Pipeline #1255 canceled with stages
in 1 minute and 48 seconds
image: docker:latest
stages:
- build
- release
services:
- docker:dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
RELEASE_TAG: $CI_REGISTRY_IMAGE:latest
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.git.autistici.org
build:
stage: build
script:
- docker build --pull -t $IMAGE_TAG .
- docker push $IMAGE_TAG
release:
stage: release
script:
- docker pull $IMAGE_TAG
- docker tag $IMAGE_TAG $RELEASE_TAG
- docker push $RELEASE_TAG
only:
- master
FROM registry.git.autistici.org/ai3/docker-chaperone-base:master
COPY conf /tmp/conf
COPY build.sh /tmp/build.sh
RUN /tmp/build.sh && rm /tmp/build.sh
docker-elasticsearch
===
Simple Docker image for Elasticsearch, built using Debian packages.
Includes a Prometheus exporter.
The image expects /etc/elasticsearch to be provided externally, and
the following environment variables should be defined:
* `PORT` - the port for ES to listen on
* `EXPORTER_PORT` - the port for the exporter
You should probably also mount /var/log/elasticsearch and
/var/lib/elasticsearch to external storage.
#!/bin/sh
#
# Install script for elasticsearch inside a Docker container.
#
# Packages that are only used to build the container. These will be
# removed once we're done.
BUILD_PACKAGES="gnupg rsync"
# Packages to install.
PACKAGES="
elasticsearch
elasticsearch-curator
"
# Release tarball for the elasticsearch prometheus exporter.
EXPORTER_RELEASE_URL="https://github.com/justwatchcom/elasticsearch_exporter/releases/download/v1.0.4rc1/elasticsearch_exporter-1.0.4rc1.linux-amd64.tar.gz"
# The default bitnami/minideb image defines an 'install_packages'
# command which is just a convenient helper. Define our own in
# case we are using some other Debian image.
if [ "x$(which install_packages)" = "x" ]; then
install_packages() {
env DEBIAN_FRONTEND=noninteractive apt-get install -qy -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --no-install-recommends "$@"
}
fi
set -x
set -e
install_packages ${BUILD_PACKAGES}
# Install the elastic.co apt key and repository.
cat | apt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YX7Ddum7x8uI95b9ye1/Xy5noPEm8cD+hp
lnpU+PBQZJ5XJ2I+1l9Nixx47wPGXeClLqcdn0ayd+v+Rwf3/XUJrvccG2YZUiQ4jWZkoxsA
07xx7Bj+Lt8/FKG7sHRFvePFU0ZS6JFx9GJqjSBbHRRkam+4emW3uWgVfZxuwcUCn1ayNgRt
KiFv9jQrg2TIWEvzYx9tywTCxc+FFMWAlbCzi+m4WD+QUWWfDQ009U/WM0ks0KwwEwSk/UDu
ToxGnKU2dQARAQABiQEfBBgBAgAJBQJSNx7KAhsMAAoJENJ9ZmzYjkK0c3MIAIE9hAR20mqJ
WLcsxLtrRs6uNF1VrpB+4n/55QU7oxA1iVBO6IFu4qgsF12JTavnJ5MLaETlggXY+zDef9sy
TPXoQctpzcaNVDmedwo1SiL03uMoblOvWpMR/Y0j6rm7IgrMWUDXDPvoPGjMl2q1iTeyHkMZ
EyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWg
R7U2r+a210W6vnUxU4oN0PmMcursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNt
fllxIu9XYmiBERQ/qPDlGRlOgVTd9xUfHFkzB52c70E=
=92oX
-----END PGP PUBLIC KEY BLOCK-----
EOF
(echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" ;
echo "deb [arch=amd64] https://packages.elastic.co/curator/5/debian9 stable main") \
> /etc/apt/sources.list.d/elastic.list
apt-get -qq update
# If we do not install a JRE before ES, the installation will fail (huh?)...
install_packages default-jre-headless
install_packages ${PACKAGES}
# There is no Debian package (yet) for the prometheus
# exporter. Download the binary from github.
curl -sL ${EXPORTER_RELEASE_URL} \
| tar --wildcards -xOzvf - '*elasticsearch_exporter' \
> /usr/sbin/elasticsearch_exporter
chmod 755 /usr/sbin/elasticsearch_exporter
# Overlay our configuration on top of /etc.
rsync -a /tmp/conf/ /etc/
# Remove packages used for installation.
apt-get remove -y --purge ${BUILD_PACKAGES}
apt-get autoremove -y
apt-get clean
rm -fr /var/lib/apt/lists/*
rm -fr /tmp/conf
exporter.service: {
command: "sh -c 'exec /usr/sbin/elasticsearch_exporter -es.indices -es.uri http://127.0.0.1:${PORT} -web.listen-address :${EXPORTER_PORT}'",
restart: true,
}
elasticsearch.service: {
command: "/bin/sh -c 'exec env ES_HOME=/usr/share/elasticsearch ES_PATH_CONF=/etc/elasticsearch /usr/share/elasticsearch/bin/elasticsearch -E http.port=${PORT}'",
kill_signal: SIGTERM,
exit_kills: true,
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment