Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ jdk:
- openjdk8
services:
- docker
script:
- ./gradlew build --refresh-dependencies --rerun-tasks --recompile-scripts --info --continue
36 changes: 23 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,34 @@ compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'


def springVersion = '4.3.12.RELEASE'
def log4jVersion = '2.10.0'
def jettyVersion = '9.4.7.v20170914'

dependencies {
compile 'ru.yandex.clickhouse:clickhouse-jdbc:0.1.19'
compile 'com.google.guava:guava:21.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'
compile 'org.springframework:spring-context:4.1.6.RELEASE'
compile 'org.apache.logging.log4j:log4j-api:2.3'
compile 'org.apache.logging.log4j:log4j-core:2.3'
compile 'org.apache.logging.log4j:log4j-web:2.3'
compile 'ru.yandex.clickhouse:clickhouse-jdbc:0.1.33'
compile 'com.google.guava:guava:23.0'
compile 'com.google.code.gson:gson:2.8.2'
compile "org.springframework:spring-jdbc:$springVersion"
compile "org.springframework:spring-context:$springVersion"
compile "org.apache.logging.log4j:log4j-api:$log4jVersion"
compile "org.apache.logging.log4j:log4j-core:$log4jVersion"
compile "org.apache.logging.log4j:log4j-web:$log4jVersion"
compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
compile 'commons-dbcp:commons-dbcp:1.4'
compile 'org.eclipse.jetty:jetty-server:9.2.10.v20150310'
compile 'org.eclipse.jetty:jetty-servlet:9.2.10.v20150310'
compile "org.eclipse.jetty:jetty-server:$jettyVersion"
compile "org.eclipse.jetty:jetty-servlet:$jettyVersion"
compile 'com.beust:jcommander:1.60'
compile 'org.jparsec:jparsec:3.0'

testCompile 'junit:junit:4.12'
testCompile 'com.mockrunner:mockrunner-jdbc:1.1.2'
testCompile "org.springframework:spring-test:$springVersion"
testCompile 'org.testcontainers:testcontainers:1.5.1'

testCompile group: 'junit', name: 'junit', version: '4.8.1'
testCompile group: 'com.mockrunner', name: 'mockrunner-jdbc', version: '1.1.2'
configurations.all {
exclude group: 'xerces', module: 'xerces'
}
}

project.sourceSets {
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
graphite-web:
build: docker/graphite-web
ports:
- "80:80"
clickhouse-server:
image: yandex/clickhouse-server
volumes:
- "./src/test/data/var-lib-clickhouse:/var/lib/clickhouse"
- "./src/test/data/etc-clickhouse-conf:/etc/clickhouse-server/conf.d"
ports:
- "8123:8123"
- "9000:9000"
34 changes: 34 additions & 0 deletions docker/graphite-web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu:xenial

RUN apt-get -y update && \
apt-get -y install python-dev python-pip libcairo2-dev libffi-dev python-requests build-essential && \
apt-get -y install git nginx uwsgi curl sqlite3 nano


RUN git clone -b 1.0.2 --depth 1 https://github.com/graphite-project/graphite-web.git /usr/local/src/graphite-web && \
git clone https://github.com/yandex/graphouse.git /usr/local/src/graphouse

WORKDIR /usr/local/src/graphite-web

RUN pip install -r requirements.txt && \
python ./setup.py install

WORKDIR /opt/graphite/webapp
RUN mkdir -p /var/log/graphite/ && \
PYTHONPATH=/opt/graphite/webapp django-admin.py collectstatic --noinput --settings=graphite.settings && \
PYTHONPATH=/opt/graphite/webapp django-admin.py migrate --settings=graphite.settings --run-syncdb

RUN cp /usr/local/src/graphouse/src/main/pySources/graphouse.py /opt/graphite/webapp/graphite/graphouse.py && \
rm /etc/nginx/sites-enabled/default && \
cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
ADD conf/local_settings.py /opt/graphite/webapp/graphite/local_settings.py
ADD conf/nginx-graphite-web.conf /etc/nginx/sites-enabled/graphite-web.conf
ADD conf/uwsgi-graphite-web.ini /etc/uwsgi/apps-enabled/graphite-web.ini

WORKDIR /opt/graphite/webapp

EXPOSE 80

CMD service nginx start && \
export PYTHONPATH=/opt/graphite/webapp && \
exec /usr/local/bin/gunicorn wsgi --workers=4 --bind=127.0.0.1:8080 --log-file=/var/log/gunicorn.log --preload --pythonpath=/opt/graphite/webapp/graphite
24 changes: 24 additions & 0 deletions docker/graphite-web/conf/local_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

LOG_DIR = '/var/log/graphite'
SECRET_KEY = '$(date +%s | sha256sum | base64 | head -c 64)'

if (os.getenv("MEMCACHE_HOST") is not None):
MEMCACHE_HOSTS = os.getenv("MEMCACHE_HOST").split(",")

if (os.getenv("DEFAULT_CACHE_DURATION") is not None):
DEFAULT_CACHE_DURATION = int(os.getenv("CACHE_DURATION"))

STORAGE_FINDERS = (
'graphite.graphouse.GraphouseFinder',
)

if (os.getenv("GRAPHOUSE_URL") is not None):
GRAPHOUSE_URL = os.getenv("GRAPHOUSE_URL")

if (os.getenv("TIME_ZONE") is not None):
TIME_ZONE = os.getenv("TIME_ZONE")

if (os.getenv("DATABASES") is not None):
TIME_ZONE = os.getenv("DATABASES")

32 changes: 32 additions & 0 deletions docker/graphite-web/conf/nginx-graphite-web.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
server {
listen 80;
listen [::]80;
root /opt/graphite/static;
index index.html;

location /media {
# django admin static files
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/;
}

location /admin/auth/admin {
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
}

location /admin/auth/user/admin {
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
}

location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
add_header 'Access-Control-Allow-Credentials' 'true';
}

}
4 changes: 4 additions & 0 deletions docker/graphite-web/conf/uwsgi-graphite-web.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[uwsgi]
plugins = python
chdir = /opt/graphite/conf
module = wsgi:application
Loading