From 11e2c9f532a0eee2516ff80d92990d8081f2792c Mon Sep 17 00:00:00 2001 From: Alexander Lang Date: Fri, 27 Mar 2020 20:40:18 +0100 Subject: [PATCH] write all config changes at once (#6) to work around problem where sometimes erlang query server is not enabled because config file was written after couchdb had already started. --- .github/workflows/test.yml | 3 +-- README.md | 2 +- action.yml | 4 ---- entrypoint.sh | 18 +----------------- 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01a71d7..ffdd645 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,10 +12,9 @@ jobs: steps: - uses: actions/checkout@v1 - name: Set up CouchDB - uses: cobot/couchdb-action@master + uses: ./ with: couchdb version: '2.3.1' - erlang query server: true - name: Test that CouchDB can be accessed run: curl -sS -f http://127.0.0.1:5984/ - name: Test that system databases are there diff --git a/README.md b/README.md index ec18f35..770553f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # CouchDB GitHub Action This [GitHub Action](https://github.com/features/actions) sets up a CouchDB database. +The Erlang query server is enabled. # Usage @@ -13,7 +14,6 @@ steps: uses: "cobot/couchdb-action@master" with: couchdb version: '2.3.1' - erlang query server: true|false - name: Do something run: | curl http://127.0.0.1:5984/ diff --git a/action.yml b/action.yml index 6de1b89..3d7abf2 100644 --- a/action.yml +++ b/action.yml @@ -11,10 +11,6 @@ inputs: description: 'Version of CouchDB to use.' required: false default: 'latest' - erlang query server: - description: 'Enable Erlang query server.' - required: false - default: true runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index befa9c7..6f0d2c5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,23 +6,7 @@ sh -c "docker run -d -p 5984:5984 -p 5986:5986 --tmpfs /ram_disk couchdb:$INPUT_ # CouchDB container name export NAME=`docker ps --format "{{.Names}}" --last 1` -# Enable delayed commits for better performance -echo "Enabling delayed commits..." -docker exec $NAME mkdir -p /opt/couchdb/etc/local.d -docker exec $NAME sh -c 'echo "[couchdb]\ndelayed_commits = true" >> /opt/couchdb/etc/local.d/01-delayed-commits.ini' - -echo "Setting nodelay option" -docker exec $NAME sh -c 'echo "[httpd]\nsocket_options = [{nodelay, true}]" >> /opt/couchdb/etc/local.d/02-performance.ini' - -echo "Configuring CouchDB to use RAM disk" -docker exec $NAME sh -c 'echo "[couchdb]\ndatabase_dir = /ram_disk\nview_index_dir = /ram_disk" >> /opt/couchdb/etc/local.d/03-ram-disk.ini' - -# Enable Erlang query server -if [ "$INPUT_ERLANG_QUERY_SERVER" = 'true' ] -then - echo "Enabling Erlang query server..." - docker exec $NAME sh -c 'echo "[native_query_servers]\nerlang = {couch_native_process, start_link, []}" >> /opt/couchdb/etc/local.d/15-erlang-query-server.ini' -fi +docker exec $NAME sh -c 'mkdir -p /opt/couchdb/etc/local.d && echo "[couchdb]\ndatabase_dir = /ram_disk\nview_index_dir = /ram_disk\ndelayed_commits = true\n[httpd]\nsocket_options = [{nodelay, true}]\n[native_query_servers]\nerlang = {couch_native_process, start_link, []}" >> /opt/couchdb/etc/local.d/01-github-action-custom.ini' wait_for_couchdb() { echo "Waiting for CouchDB..."