From 472f254ab5889442647037055d700cfd964c4381 Mon Sep 17 00:00:00 2001 From: hylom Date: Fri, 28 Sep 2018 20:28:40 +0900 Subject: [PATCH] test-container: add install-test --- test-container/Makefile | 18 +++ test-container/files/install-test-entrypoint.sh | 13 ++ test-container/installtest_Dockerfile | 7 ++ test-container/newslash.conf | 154 ++++++++++++++++++++++++ 4 files changed, 192 insertions(+) create mode 100644 test-container/files/install-test-entrypoint.sh create mode 100644 test-container/installtest_Dockerfile create mode 100644 test-container/newslash.conf diff --git a/test-container/Makefile b/test-container/Makefile index 08837d50..746d0dd3 100644 --- a/test-container/Makefile +++ b/test-container/Makefile @@ -3,6 +3,12 @@ HOST_NAME= sdtest.osdn.co.jp:5000 NEWSLASH_DIR=$(shell pwd)/../ PORT_OPTS=-p 3000:3000 SEARCHD_DOCKERFILE=Dockerfile_for_searchd +INSTALL_TEST_DOCKERFILE=installtest_Dockerfile + +DB_HOST=172.17.0.7 +REDIS_HOST=172.17.0.8 +APT_REPO_DIR=/var/debian-osdn/debian-osdn/srad-devel +APT_REPO=file:/var/local-repo ./ build-base: Dockerfile files docker build $(DOCKER_OPTS) -t newslash-base . @@ -16,6 +22,18 @@ searchd: $(SEARCHD_DOCKERFILE) files searchd-run: docker run -ti --rm -p 6000:6000 -v $(NEWSLASH_DIR):/var/newslash newslash-searchd-base bash +install-test-env: $(INSTALL_TEST_DOCKERFILE) files + docker build $(DOCKER_OPTS) -f $< -t newslash-install-test . + +install-test: + docker run -ti --rm -v $(APT_REPO_DIR):/var/local-repo \ + --add-host srad-test-db:$(DB_HOST) \ + --add-host newslash-redis:$(REDIS_HOST) \ + -v $(shell pwd)/newslash.conf:/etc/newslash/newslash.conf \ + -e APT_REPO="$(APT_REPO)" \ + -p 8000:80 \ + newslash-install-test bash + build-k8s-test: docker build -f Dockerfile_k8s $(DOCKER_OPTS) -t $(HOST_NAME)/osdn/newslash-test . diff --git a/test-container/files/install-test-entrypoint.sh b/test-container/files/install-test-entrypoint.sh new file mode 100644 index 00000000..4944bd5e --- /dev/null +++ b/test-container/files/install-test-entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -eo pipefail + +echo deb $APT_REPO > /etc/apt/sources.list.d/local-repo.list +apt-get update +apt-get install -y --allow-unauthenticated newslash-sradjp + +hypnotoad /usr/share/newslash/script/newslash_web + +if [ "$1" != "" ]; then + exec "$@" +fi + diff --git a/test-container/installtest_Dockerfile b/test-container/installtest_Dockerfile new file mode 100644 index 00000000..96fcf5b7 --- /dev/null +++ b/test-container/installtest_Dockerfile @@ -0,0 +1,7 @@ +FROM newslash-base + +COPY files/install-test-entrypoint.sh /entrypoint.sh +RUN chmod 755 /entrypoint.sh +ENTRYPOINT [ "/entrypoint.sh" ] + +EXPOSE 80 diff --git a/test-container/newslash.conf b/test-container/newslash.conf new file mode 100644 index 00000000..5bb947f3 --- /dev/null +++ b/test-container/newslash.conf @@ -0,0 +1,154 @@ +--- +#BasicAuth: +# enable: 1 +# username: 'osdn' +# password: 'Sfsd7573' +# message: this is newslash + +hypnotoad: + listen: + - http://0.0.0.0:80 + - https://0.0.0.0:443?cert=/etc/letsencrypt/live/test.srad.jp/cert.pem&key=/etc/letsencrypt/live/test.srad.jp/privkey.pem + pid_file: /var/run/newslash/newslash.pid + +Site: + name: srad + root: "/" + base_url: https//test.srad.jp + description: yet another srad + img_path: "/img" + css_path: "/css" + topic_icon_base_url: "/img/topic_icon" + +ReCaptcha: + site_key: 6LcPlyIUAAAAAN2d4Gw4q2DWLtFCDYmn5tSVqS3w + secret_key: 6LcPlyIUAAAAAIlTdXjw3tIz_U-lUwW45RudOXfR + +ACL: + exclude: ["^/img/", "^/css/", "^/js/", "^/static/", "^/login", "^/logout", "^/banned"] + +Search: + searchd_host: 127.0.0.1 + searchd_port: 6000 + +Searchd: + index_path: /var/newslash/lucene_index + +Polls: + TTL: 120 + TTL_unit: "days" + +Preprocessor: + targets: + css/newslash.css: + source: css/newslash.less + type: less + less: + command: /usr/bin/nodejs + content-type: text/css + options: + - "--no-deprecation" + - /usr/bin/lessc + - "--include-path=./css" + - "--no-color" + - "-" + +JavaScriptLoader: + source_directory: public/js + mode: production + +FeedFetcher: + fetch_timeout: 5 + http_proxy: http://proxy:8080/ + https_proxy: http://proxy:8080/ + +System: + secret_key: njknQNIODGinkladf + session_store: kvs + salt: '' + readonly: 0 + +Repository: + path: /var/newslash/repository + +Log: + access_log: + local_file: /var/log/newslash/access.log + mode: local_file + autoflush: 1 + system_log: + local_file: /var/log/newslash/newslash.log + level: info + mode: local_file + +Analytics: + tag: "UA-739864-18" + +Story: + title_max_byte: 100 + +IndexPage: + story_per_page: 10 + +Timeline: + popular_period: { hours: 6 } + item_per_page: 20 + +Database: + host: srad-test-db + name: slash + user: slash + password: hoge + +KeyValueStore: + type: redis + host: newslash-redis:6379 + +Legacy: + memcached: sd-master:11211 + +Faculties: + comments: + 1000: [ipid, subnetid] + metamoderations: + 1000: [uid] + moderations: + 1000: [ipid, subnetid, uid, m2uid] + stories: + 1000: [hits, hitparade] + submissions: + 1000: [ipid, subnetid, note, comment] + +Editor: + allowed_tags: + b: [] + i: [] + p: [] + br: [] + a: + - href + ol: + - start + ul: [] + li: [] + dl: [] + dt: [] + dd: [] + em: [] + strong: [] + tt: [] + blockquote: + - title + - cite + div: [] + ecode: [] + del: [] + ins: [] + sub: [] + sup: [] + quote: [] + strike: [] + +Hsts: + redirect_non_ssl: 0 + -- 2.11.0