How to install noteself with couchdb in your own server with Debian stretch

I’ve been looking for something like this and I wanted to use it in my own server, after playing a bit with the configuration and using some tips of this thread in french https://forum.tiddlywiki.fr/t/noteself-couchdb/403/4 finally i could configure it in my server :smiley:

Here are the steps i’ve followed:

  • First we add the couchdb repository:
    echo "deb https://apache.bintray.com/couchdb-deb stretch main" \ | sudo tee -a /etc/apt/sources.list

  • Then we update the info of the repositories and install couchdb

sudo apt-get update && sudo apt-get install couchdb

  • After that we have to set the admin password and bind the database port to 0.0.0.0 to be able to connect from everywhere
    nano /opt/couchdb/etc/local.ini

  • We restart the service to apply changes

service couchdb restart

  • After that we can create the user and password that we’re going to use with our noteself database
curl -X PUT http://admin_user:admin_password@localhost:5984/_users/org.couchdb.user:new_user\
            -H "Accept: application/json" \
            -H "Content-Type: application/json" \
            -d '{"name": "new_user", "password": "user_password", "roles": [], "type": "user"}'
  • Then we can go into the Fauxton interface in:

http://server_address:5984/_utils/

  • We log in with the admin user and password that we set while installing couchdb and we create a new database and add permission to the user that we just created

  • Then we can open the empty noteself file and configure the sync configuration fields with:

  • CouchDB URL: http://server_address:5984

  • Remote database name: database_name

  • Save config, and click the offline button and log in with the user and password we created before and that’s it :slight_smile:, if we want to use it from other location we just use the same config and user name and password and voila everything is there :wink:

1 Like

This is something to celebrate: :tada::tada::balloon::balloon::sparkles::sparkles::confetti_ball::confetti_ball::balloon::balloon::tada::tada:
Thanks for making the first post on the tutorials section !
I edited your post to properly highlight your CURL command.

And also, welcome to the community!
I guess the first step on the tutorial is to open a shell on your target server.

Regards

Thank you, yes, I’m assuming a minimal installation of debian stretch and you have a terminal shell opened :stuck_out_tongue:

Using the same type of setup, a couchdb on my own server, running Debian stretch. Everything looks fine to me in the couchdb installation, i.e. created a user, created a database, granted (admin) permissions to this user.
But … when trying to connect the database with the noteself file I always get a " PouchAdaptor - Login failed" message :frowning:

What could be the reason? Any hints highly appreciated!

It is probably a problem with CORS.

You can easily configure CORS with this tool: https://github.com/pouchdb/add-cors-to-couchdb

npm install -g add-cors-to-couchdb
add-cors-to-couchdb

Or if it is a remote database:

add-cors-to-couchdb http://me.iriscouch.com -u myusername -p mypassword

Regards

First of all, thank you for taking the time to reply!

I have it working now! Your post pointed me into the right direction, even if it was not the complete solution, as it turned out. Firstly I followed your direction. I just manually changed the settings as mentioned on the “add-cors–to-couchdb” github page via the Fauxton screens.

The second part has to do with my specific setup. I wanted the couchdb services integrated in an existing apache server. So I configured a reverse proxy pointing to the standard couchdb installation. This is where it was failing because of missing authentication and some ssl aspects. Guess the details of the apache setup are not to be discussed here.

Either way, thanks for your help! Now off to explore the possibilities of noteself :wink:

1 Like

Glad to hear that !

Enjoy it !
Please consider posting a tutorial if you think that your experience can help others, and if you want to of course.