Skip to content

Commit 078b9d2

Browse files
committed
Initial working commit
0 parents  commit 078b9d2

File tree

10 files changed

+852
-0
lines changed

10 files changed

+852
-0
lines changed

.idea/checkstyle-idea.xml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# VERSION 1.9.0
2+
# AUTHOR: Jaskaran singh
3+
# DESCRIPTION: Basic Airflow container
4+
# BUILD: docker build --rm -t jksingh/docker-airflow .
5+
6+
FROM python:3.6-slim
7+
LABEL maintainer="JKsingh_"
8+
9+
# Never prompts the user for choices on installation/configuration of packages
10+
ENV DEBIAN_FRONTEND noninteractive
11+
ENV TERM linux
12+
13+
# Airflow
14+
ARG AIRFLOW_VERSION=1.9.0
15+
ARG AIRFLOW_HOME=/usr/local/airflow
16+
17+
# Define en_US.
18+
ENV LANGUAGE en_US.UTF-8
19+
ENV LANG en_US.UTF-8
20+
ENV LC_ALL en_US.UTF-8
21+
ENV LC_CTYPE en_US.UTF-8
22+
ENV LC_MESSAGES en_US.UTF-8
23+
24+
RUN set -ex \
25+
&& buildDeps=' \
26+
python3-dev \
27+
libkrb5-dev \
28+
libsasl2-dev \
29+
libssl-dev \
30+
libffi-dev \
31+
build-essential \
32+
libblas-dev \
33+
liblapack-dev \
34+
libpq-dev \
35+
git \
36+
' \
37+
&& apt-get update -yqq \
38+
&& apt-get upgrade -yqq \
39+
&& apt-get install -yqq --no-install-recommends \
40+
$buildDeps \
41+
python3-pip \
42+
python3-requests \
43+
mysql-client \
44+
mysql-server \
45+
default-libmysqlclient-dev \
46+
apt-utils \
47+
curl \
48+
rsync \
49+
netcat \
50+
locales \
51+
&& sed -i 's/^# en_US.UTF-8 UTF-8$/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
52+
&& locale-gen \
53+
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
54+
&& useradd -ms /bin/bash -d ${AIRFLOW_HOME} airflow \
55+
&& pip install -U pip setuptools wheel \
56+
&& pip install Cython \
57+
&& pip install pytz \
58+
&& pip install pyOpenSSL \
59+
&& pip install ndg-httpsclient \
60+
&& pip install pyasn1 \
61+
&& pip install apache-airflow[crypto,celery,postgres,hive,jdbc,mysql]==$AIRFLOW_VERSION \
62+
&& pip install celery[redis]==4.1.1 \
63+
&& apt-get purge --auto-remove -yqq $buildDeps \
64+
&& apt-get autoremove -yqq --purge \
65+
&& apt-get clean \
66+
&& rm -rf \
67+
/var/lib/apt/lists/* \
68+
/tmp/* \
69+
/var/tmp/* \
70+
/usr/share/man \
71+
/usr/share/doc \
72+
/usr/share/doc-base
73+
74+
COPY script/entrypoint.sh /entrypoint.sh
75+
COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
76+
77+
RUN chmod +x /entrypoint.sh
78+
79+
RUN chown -R airflow: ${AIRFLOW_HOME}
80+
81+
EXPOSE 8080 5555 8793
82+
83+
USER airflow
84+
WORKDIR ${AIRFLOW_HOME}
85+
ENTRYPOINT ["/entrypoint.sh"]
86+
CMD ["webserver"] # set default arg for entrypoint

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright [2018] Jaskaran singh
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Docker-airflow with MySql as backend
2+
3+
This repository contains **Dockerfile** of [apache-airflow](https://github.com/apache/incubator-airflow) .
4+
5+
## Informations
6+
7+
* Based on Python (3.6-slim) official Image [python:3.6-slim](https://hub.docker.com/_/python/) and uses the official [MySql](https://hub.docker.com/_/mysql/) as backend and [Redis](https://hub.docker.com/_/redis/) as queue
8+
* Install [Docker](https://www.docker.com/)
9+
* Install [Docker Compose](https://docs.docker.com/compose/install/)
10+
* Following the Airflow release from [Python Package Index](https://pypi.python.org/pypi/apache-airflow)
11+
12+
13+
## Build
14+
15+
For Building the docker container for airflow you first need to build the docker image using the dockerfile added in the repository.For adding [Extra Packages](https://airflow.incubator.apache.org/installation.html#extra-package) edit the docker file and then build.
16+
17+
docker build --rm -t jksingh/docker-airflow .
18+
19+
Don't forget to update the airflow images in the docker-compose files to jksingh/docker-airflow:latest.
20+
21+
## Usage
22+
23+
By default, docker-airflow runs Airflow with **SequentialExecutor** :
24+
25+
docker run -d -p 8080:8080 jksingh/docker-airflow webserver
26+
27+
If you want to run another executor, use the other docker-compose files provided in this repository.
28+
29+
For **LocalExecutor** :
30+
31+
docker-compose -f docker-compose-mysql-local.yml up -d
32+
33+
For **CeleryExecutor** :
34+
35+
docker-compose -f docker-compose-mysql-celery.yml up -d
36+
37+
NB : If you want to have DAGs example loaded (default=False), you've to set the following environment variable :
38+
39+
`LOAD_EX=n`
40+
41+
docker run -d -p 8080:8080 -e LOAD_EX=y jksingh/docker-airflow
42+
43+
44+
## UI Links
45+
46+
- Airflow: [localhost:8080](http://localhost:8080/)
47+
- Flower: [localhost:5555](http://localhost:5555/)
48+
49+
50+
# Issues
51+
52+
- Issue Tracker: https://github.com/jksinghpro/docker-airflow/issues
53+
54+

0 commit comments

Comments
 (0)