Skip to content

Commit

Permalink
use localhost to access CouchDB (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
langalex authored Oct 25, 2019
1 parent badc96c commit 60db9bc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up CouchDB
id: couchdb
uses: cobot/couchdb-action@master
with:
couchdb version: '2.3.1'
erlang query server: true
- name: Test that CouchDB can be accessed
run: curl -sS -f http://${{steps.couchdb.outputs.ip}}:5984/
run: curl -sS -f http://127.0.0.1:5984/
- name: Test that system databases are there
run: curl -sS -f http://${{steps.couchdb.outputs.ip}}:5984/_users
run: curl -sS -f http://127.0.0.1:5984/_users
- name: Test that the Erlang query server is enabled
run: |
curl -sS -f 'http://${{steps.couchdb.outputs.ip}}:5984/_users/_design/test' -X PUT -H 'Content-Type: application/json' --data '{"views":{"test":{"map":"fun({Doc}) -> Emit(proplists:get_value(<<\"name\">>, Doc, null), 1) end."}},"language":"erlang"}'
curl -sS -f 'http://${{steps.couchdb.outputs.ip}}:5984/_users/_design/test/_view/test'
curl -sS -f 'http://127.0.0.1:5984/_users/_design/test' -X PUT -H 'Content-Type: application/json' --data '{"views":{"test":{"map":"fun({Doc}) -> Emit(proplists:get_value(<<\"name\">>, Doc, null), 1) end."}},"language":"erlang"}'
curl -sS -f 'http://127.0.0.1:5984/_users/_design/test/_view/test'
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ Basic:
```yaml
steps:
- name: Set up CouchDB
id: couchdb
uses: "cobot/couchdb-action@master"
with:
couchdb version: '2.3.1'
erlang query server: true|false
- name: Do something
run: |
curl http://${{steps.couchdb.outputs.ip}}:5984/
curl http://127.0.0.1:5984/
```
Expand Down
3 changes: 0 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ inputs:
description: 'Enable Erlang query server.'
required: false
default: true
outputs:
ip:
description: IP address of CouchDB
runs:
using: 'docker'
image: 'Dockerfile'
3 changes: 0 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ then
echo "Enabling Erlang query server..."
docker exec $NAME mkdir -p /opt/couchdb/etc/local.d
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'
# docker exec $NAME service couchdb restart
fi

wait_for_couchdb() {
Expand All @@ -32,5 +31,3 @@ echo "Setting up CouchDB system databases..."
docker exec $NAME curl -sS 'http://127.0.0.1:5984/_users' -X PUT -H 'Content-Type: application/json' --data '{"id":"_users","name":"_users"}' > /dev/null
docker exec $NAME curl -sS 'http://127.0.0.1:5984/_global_changes' -X PUT -H 'Content-Type: application/json' --data '{"id":"_global_changes","name":"_global_changes"}' > /dev/null
docker exec $NAME curl -sS 'http://127.0.0.1:5984/_replicator' -X PUT -H 'Content-Type: application/json' --data '{"id":"_replicator","name":"_replicator"}' > /dev/null

echo ::set-output name=ip::$hostip

0 comments on commit 60db9bc

Please sign in to comment.