forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker] introduce a pulsar standalone image (apache#2545)
## Motivation `pulsar` and `pulsar-all` are designed for running pulsar components on production. although it can be used for running standalone, people still need to run a separate docker container for pulsar dashboard. ## Changes introduce a `pulsar-standalone` image to package everything into one image. so people can run launch a pulsar standalone in one line command in docker, including dashboard.
- Loading branch information
Showing
38 changed files
with
2,957 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
FROM apachepulsar/pulsar-all:latest | ||
|
||
RUN apt-get update | ||
RUN apt-get -y install postgresql sudo nginx supervisor | ||
|
||
# Python dependencies | ||
RUN pip install uwsgi 'Django<2.0' psycopg2 pytz requests | ||
|
||
# Postgres configuration | ||
COPY conf/postgresql.conf /etc/postgresql/9.6/main/ | ||
|
||
# Configure nginx and supervisor | ||
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 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 | ||
|
||
# Collect all static files needed by Django in a | ||
# single place. Needed to run the app outside the | ||
# Django test web server | ||
RUN cd /pulsar/django && ./manage.py collectstatic --no-input | ||
|
||
ENV SERVICE_URL http://127.0.0.1:8080 | ||
EXPOSE 80 | ||
|
||
CMD ["supervisord", "-n"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
upstream django { | ||
server unix:/tmp/uwsgi.sock; | ||
} | ||
|
||
server { | ||
listen 80 default_server; | ||
|
||
charset utf-8; | ||
|
||
location /static { | ||
alias /pulsar/django/static; | ||
} | ||
|
||
location / { | ||
uwsgi_pass django; | ||
include /pulsar/conf/uwsgi_params; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
# Relax durability to increase write throughput | ||
fsync = off | ||
full_page_writes = off | ||
synchronous_commit = off | ||
|
||
# Default configs | ||
data_directory = '/var/lib/postgresql/9.6/main' | ||
hba_file = '/etc/postgresql/9.6/main/pg_hba.conf' | ||
ident_file = '/etc/postgresql/9.6/main/pg_ident.conf' | ||
external_pid_file = '/var/run/postgresql/9.6-main.pid' | ||
|
||
port = 5432 | ||
max_connections = 100 | ||
|
||
datestyle = 'iso, mdy' | ||
default_text_search_config = 'pg_catalog.english' | ||
stats_temp_directory = '/var/run/postgresql/9.6-main.pg_stat_tmp' | ||
timezone = 'UTC' | ||
log_timezone = 'UTC' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
[program:postgres] | ||
command = /usr/lib/postgresql/9.6/bin/postgres -D /etc/postgresql/9.6/main | ||
user = postgres | ||
|
||
[program:uwsgi] | ||
command = /usr/local/bin/uwsgi --ini /pulsar/conf/uwsgi.ini | ||
|
||
[program:nginx] | ||
command = /usr/sbin/nginx | ||
|
||
[program:collector] | ||
command = /pulsar/django/collector.sh | ||
|
||
[program:pulsar] | ||
command = /pulsar/bin/pulsar standalone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
# django.ini file | ||
[uwsgi] | ||
|
||
uid = www-data | ||
gid = www-data | ||
|
||
# master | ||
master = true | ||
|
||
# maximum number of processes | ||
processes = 10 | ||
|
||
# the socket (use the full path to be safe) | ||
socket = /tmp/uwsgi.sock | ||
|
||
# with appropriate permissions - *may* be needed | ||
# chmod-socket = 664 | ||
|
||
# the base directory | ||
chdir = /pulsar/django | ||
|
||
# Django's wsgi file | ||
module = dashboard.wsgi | ||
|
||
# clear environment on exit | ||
vacuum = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
uwsgi_param QUERY_STRING $query_string; | ||
uwsgi_param REQUEST_METHOD $request_method; | ||
uwsgi_param CONTENT_TYPE $content_type; | ||
uwsgi_param CONTENT_LENGTH $content_length; | ||
|
||
uwsgi_param REQUEST_URI $request_uri; | ||
uwsgi_param PATH_INFO $document_uri; | ||
uwsgi_param DOCUMENT_ROOT $document_root; | ||
uwsgi_param SERVER_PROTOCOL $server_protocol; | ||
uwsgi_param HTTPS $https if_not_empty; | ||
|
||
uwsgi_param REMOTE_ADDR $remote_addr; | ||
uwsgi_param REMOTE_PORT $remote_port; | ||
uwsgi_param SERVER_PORT $server_port; | ||
uwsgi_param SERVER_NAME $server_name; |
Oops, something went wrong.