Skip to content

Commit

Permalink
[Issue 5415][docker build]Updating docker build for pulsar-standalone…
Browse files Browse the repository at this point in the history
… to use main dashboard sou… (apache#5420)

* Updating docker build for puslar-standalone to use main dashboard source files; deleting duplicate files

* Committed the wrong Dockerfile
  • Loading branch information
cdbartholomew authored and merlimat committed Oct 29, 2019
1 parent 6df7cec commit 2983175
Show file tree
Hide file tree
Showing 36 changed files with 33 additions and 2,807 deletions.
2 changes: 1 addition & 1 deletion dashboard/django/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _fetch_broker_stats(cluster, broker_host_port, timestamp):
active_broker.save()

# Get topics stats
topics_stats = get(broker_url, '/admin/broker-stats/destinations')
topics_stats = get(broker_url, '/admin/v2/broker-stats/topics')

clusters = dict((cluster.name, cluster) for cluster in Cluster.objects.all())

Expand Down
3 changes: 1 addition & 2 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@
ROOT_DIR=$(git rev-parse --show-toplevel)
cd $ROOT_DIR/docker

mvn package -Pdocker
mvn -f ../dashboard/pom.xml package -Pdocker

mvn package -Pdocker
45 changes: 31 additions & 14 deletions docker/pulsar-standalone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,54 @@
# under the License.
#

# Using files from pulsar-all docker image for pulsar
FROM apachepulsar/pulsar-all:latest as pulsar

# Using files from pulsar-dashboard for the dashboard
FROM apachepulsar/pulsar-dashboard:latest as dashboard

# Restart from
FROM openjdk:8-jdk

# Copy pulsar files from pulsar-all
COPY --from=pulsar /pulsar /pulsar

# Copy dashboard files from pulsar-dashboard
COPY --from=dashboard /pulsar/django /pulsar/django
COPY --from=dashboard /pulsar/requirements.txt /pulsar/django
COPY --from=dashboard /pulsar/conf/* /pulsar/conf/

# Note that the libpq-dev package is needed here in order to install
# the required python psycopg2 package (for postgresql) later
RUN apt-get update
RUN apt-get -y install python2.7 python-pip postgresql-9.6 sudo nginx supervisor
RUN apt-get -y install python2.7 python-pip postgresql-9.6 sudo nginx supervisor libpq-dev

# Python dependencies
RUN pip2 -qq install uwsgi 'Django<2.0' 'psycopg2==2.7.7' pytz requests
RUN pip2 install -r /pulsar/django/requirements.txt

# Postgres configuration
COPY conf/postgresql.conf /etc/postgresql/9.6/main/
COPY --from=dashboard /etc/postgresql/9.6/main/postgresql.conf /etc/postgresql/9.6/main/postgresql.conf

# Configure supervisor
COPY --from=dashboard /etc/supervisor/conf.d/supervisor-app.conf /etc/supervisor/conf.d/supervisor-app.conf

# Configure nginx and supervisor
# Add pulsar to supervisord. Redirect logs to stdout
RUN echo "[program:pulsar]\n\
command = /pulsar/bin/pulsar standalone\n\
stdout_logfile=/dev/fd/1\n\
stdout_logfile_maxbytes=0\n\
redirect_stderr=true" >> /etc/supervisor/conf.d/supervisor-app.conf

# Configure nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
COPY conf/nginx-app.conf /etc/nginx/sites-available/default
COPY conf/supervisor-app.conf /etc/supervisor/conf.d/
COPY --from=dashboard /etc/nginx/sites-available/default /etc/nginx/sites-available/default

# Copy web-app sources
COPY . /pulsar/

# Setup database and create tables
RUN sudo -u postgres /etc/init.d/postgresql start && \
sudo -u postgres psql --command "CREATE USER docker WITH PASSWORD 'docker';" && \
sudo -u postgres createdb -O docker pulsar_dashboard && \
cd /pulsar/django && \
./manage.py migrate && \
sudo -u postgres /etc/init.d/postgresql stop
COPY --from=dashboard /pulsar/init-postgres.sh /pulsar/django/init-postgres.sh
RUN mkdir /data
RUN /pulsar/django/init-postgres.sh
RUN sudo -u postgres /etc/init.d/postgresql stop

# Collect all static files needed by Django in a
# single place. Needed to run the app outside the
Expand Down
37 changes: 0 additions & 37 deletions docker/pulsar-standalone/conf/nginx-app.conf

This file was deleted.

38 changes: 0 additions & 38 deletions docker/pulsar-standalone/conf/postgresql.conf

This file was deleted.

34 changes: 0 additions & 34 deletions docker/pulsar-standalone/conf/supervisor-app.conf

This file was deleted.

45 changes: 0 additions & 45 deletions docker/pulsar-standalone/conf/uwsgi.ini

This file was deleted.

16 changes: 0 additions & 16 deletions docker/pulsar-standalone/conf/uwsgi_params

This file was deleted.

Loading

0 comments on commit 2983175

Please sign in to comment.