{"id":16889688,"url":"https://github.com/benoitc/couchdbproxy","last_synced_at":"2025-03-22T08:31:06.753Z","repository":{"id":689969,"uuid":"334110","full_name":"benoitc/couchdbproxy","owner":"benoitc","description":"Simple multinode couchdb proxy","archived":false,"fork":false,"pushed_at":"2010-08-15T09:53:30.000Z","size":1477,"stargazers_count":57,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T11:52:30.499Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benoitc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-10-11T18:46:56.000Z","updated_at":"2021-12-14T01:26:23.000Z","dependencies_parsed_at":"2022-08-16T10:45:12.649Z","dependency_job_id":null,"html_url":"https://github.com/benoitc/couchdbproxy","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benoitc","download_url":"https://codeload.github.com/benoitc/couchdbproxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244931477,"owners_count":20534007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T16:58:23.060Z","updated_at":"2025-03-22T08:31:06.238Z","avatar_url":"https://github.com/benoitc.png","language":"Erlang","readme":"# CouchDBProxy\n\nSimple multinode couchdb proxy. It allows you to proxy from one IP address to\nmultiple couchdb nodes running on different IPs or ports. CouchDBProxy also\nsupports streaming, some basic url rewriting and domain aliasing. You could\nadd/remove a *user couchdb node* or a *domain alias* dynamically. So basically\nit allows you to host a little `couch.io` like on your own site.\n\nWith CouchDBProxy you could do something like\n\n    http://someuser.yourdomain.com -\u003e someip:someport\n    \nor \n\n    http://mydomain.com - someip:someport/mydb/_design/mycouchapp\n    http://someuser.yourdomain.com -\u003e someip:someport\n\nCouchDBProxy uses [couchbeam](http://bitbucket.org/benoitc/couchbeam/) to dialog\nwith CouchDB and [mochiweb](http://code.google.com/p/mochiweb/) for HTTP\nsyntax-management.\n\n\n## Installation\n\n*Users of 0.2 you can migrate your data to the new api by running\n./scripts/migrate01.py. It will update your views and migrate data.*\n\n### 1. Requirements\n\n  - bind 9 or any dnDNSs server that handle wildcards in ANAME. -\n  - [CouchDB](http://couchdb.apache.org) 0.10.x or newer.\n  - [Python CouchdbKit](http://bitbucket.org/benoitc/couchdbkit/) for console utilities \u0026 basic setup.\n\n\n### 2. Configure Bind\n\nAdd your our zone. Here is an example to configure a local zone for development\nthough configuration is the same for production server, you just have to change\nthe domain name.\n\nin named.conf add:\n\n    zone \"CouchDBProxy.dev\" {\n            type master;\n            file \"CouchDBProxy.dev.zone\";\n            allow-transfer { localhost; };\n    };\n\n\nthen add a zone. On my machine it's in /var/named. Create a file\ncouchdbproxy.dev.zone:\n\n    $TTL    86400\n    @       IN      SOA     ns.couchdbproxy.dev. root.couchdbproxy.dev.  (\n                                          2009091111 ; Serial\n                                          10800       ; Refresh\n                                                                              3600        ; Retry\n                                                                              3600000     ; Expire\n                                                                              86400 )     ; Minimum\n\n                  IN      NS      ns0.couchdbproxy.dev.\n\n                  IN      A       127.0.0.1\n    ns0           IN      A       127.0.0.1\n    *             IN      A       127.0.0.1\n\n### 3. Configure Master Couchdb Node.\n\nThis node will be used to store and retrieve dynamically nodes for one user and\ncname. Install CouchDB somewhere by following [CouchDB installation](http://wiki.apache.org/couchdb/Installation) and set your en configuration file. All configuration is set in couchdbproxy application environment at startup. One full configuration file is in config:\n\n    {couchdbproxy_hostname, \"couchdbproxy.dev\"}. % base hostname used for rewriting\n    {couchdbproxy_name, couchdbproxy}. % erlang node name\n    {couchdbproxy_port, 8000}. % port on which couchdbproxy listen\n    {couchdbproxy_ip, \"0.0.0.0\"}. % ip of couchdbproxy\n    {couchdbproxy_cookie, 'couchdbproxy_cookie_default'}. % erlang cookiue\n    {couchbeam_heart_command, \"start.sh\"}. % heartbeat command\n\n    % params of couchdb node used to maintain connections user-couchdb\n    {couchdbproxy_couchdb_params, [{host, \"127.0.0.1\"}, {port, 5984}]}. % parameters of master couchdb \n    {couchdbproxy_db, \"couchdbproxy\"}. % couchdb database\n    \n`couchdbproxy_hostname` is the basename used to detect CNAME and user urls. `couchdbproxy_port` is the port on which you want to run CouchDBProxy.\n    \nif you want to add an admin username/password do, change `couchdbproxy_couchdb_params` accordingly:\n\n    {proxy_hostconfig, [{host, \"127.0.0.1\"}, {port, 5984}, {username, \"someuser\"}, {password, \"somepassword\"}]}.\n    \n    \n### 4. Build CouchDBProxy and Setup the Basic Design Doc:\n\nInstall couchdbkit:\n\n    easy_install -U couchdbkit\n\nThen, in CouchDBProxy source folder run:\n\n    make \u0026\u0026 make setup\n\nThat's it.\n\n\n## Play with CouchDBProxy\n\nYou can add a node, username, alias dynamically thanks to the `couchdproxy`\nscript in `scripts` folder.\n\n### run couchdbproxy\n  \nAt development run `start-dev.sh` script:\n    \n    ./start-dev.sh config/couchdbproxy.erlenv\n    \nOr in production you could run `start.sh` script:\n\n    ./start.sh config/couchdbproxy.erlenv\n\n### basic usage \n\nThe first thing you have to do is to setup a machine You can launch CouchDB\nnodes on this machine on different ports. To add a machine on localhost run:\n\n    ./couchdbproxy.py add_machine http://127.0.0.1:5984 m0 127.0.0.1\n    \nThen you want to set a couchdb node on m0 machine:\n\n    ./couchdbproxy.py add_node http://127.0.0.1:5984 m0 benoitc 5985\n    \n    Connect on `http://benoitc.couchdbproxy.dev:8000` and you will fall in\n    benoitc node.\n\nTo remove this node :\n\n    ./couchdbproxy.py remove_node http://127.0.0.1:5984 benoitc\n    \nGet more usage by running command `./couchdbproxy.py --help`\n\n### Cool Features\n\nThere are cool url rewriting offered by CouchDBProxy that allows you to access\neasily on a database or a couchapp. For example:\n\nIf the user `benoitc` has a database `blog` on its node, you can access it with\nthe url `http://blog.benoitc.CouchDBProxy.dev:8000`. If there is a couchapp in\nthis database named `myblog`, you can also access to it with the url\n`http://myblog.blog.benoitc.CouchDBProxy.dev:8000`.\n\nNow imagine, you have a domain name called `benoitc.local` and want to access to\nthe the couchapp `myblog` in `blog` db from benoitc's couchdb node. You could do\nit easily by pointing `benoitc.local` to your node and add an alias:\n\n    ./couchdbproxy.py add_alias http://127.0.0.1:5984 benoitc benoitc.local /blog/_design/myblog\n    \nEasy!\n\n## Todo:\n\n- caching with redis/memcached\n- add more dispatching possibilities\n- ...\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fcouchdbproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitc%2Fcouchdbproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fcouchdbproxy/lists"}