I’m now trying to gather information about use of sync_gateway. I have 2 couchbase servers which are not on my local and I created sync_gateway bucket in both. I filled my default buckets on both servers with MVC.
I read that I need to create a config file in json and call it. But I don’t understand where am I gonna create it and how to call it because I can’t write anything on here :
I thought that would be some kind of platform to write code on, isn’t it?
thanks for the response. I tried to change that file but it said “access is denied”. Is that normal? So I deleted that file and created another and move it to that directory.when I start the .exe it still says
2016-04-14T16:49:12.770+03:00 ==== Couchbase Sync Gateway/1.2.0(83;41aa099) ====
2016-04-14T16:49:12.771+03:00 Opening db /sync_gateway as bucket “sync_gateway”, pool “default”, server walrus:
2016-04-14T16:49:12.771+03:00 Opening Walrus database sync_gateway on walrus:
2016-04-14T16:49:12.772+03:00 Using default sync function ‘channel(doc.channels)’ for database “sync_gateway”
2016-04-14T16:49:12.772+03:00 Reset guest user to config
2016-04-14T16:49:12.772+03:00 Starting profile server on
2016-04-14T16:49:12.772+03:00 Starting admin server on 127.0.0.1:4985
2016-04-14T16:49:12.779+03:00 Starting server on localhost:4984 …
I cant see the ports I entered here, still looks like the default.
thanks
‘Access Denied’ is normal as the installer runs with Admin privileges.
You wil need to find the NotePad (or other editor) icon, right click on it and select ‘Run as administrator’, then you will be able to edit and save the file.
The best way to test changes to the config file is to restart the Sync Gateway Windows Service wrapper.
You can access the Services panel via:
Control Panel\System and Security\Administrative Tools
There should be a service called Couchbase Sync Gateway
Restart the service to pick up config changes.
If you want to run Sync Gateway directly you need to pass serviceconfig.json as a command line parameter e.g.
oh, there is nothing like Couchbase Sync Gateway on my administrative tools.I couldn’t restart it. I only installed couchbase-sync-gateway-enterprise_1.2.0-83b_x86_64.exe, isn’t it enough?
I just closed and reopened the sync_gateway.exe file after I edited serviceconfig.json but It did not work obviously. What am I doing wrong ?
@jens@adamf@andy ok thank you so much . now it saw the changes. I did something and It said :
2016-04-15T15:26:52.564+03:00 FATAL: Failed to start HTTP server on http://syncGatewayIP:4984: listen tcp: too many colons in address http://syncGatewayIP:4984 -- rest.(*ServerConfig).serve() at config.go:591
It says that when I enter couchbaseServerIP instead of syncGatewayIP too.
I edited the post like million times, everytime I try something else,and there were 2 doc in my sync_gateway before I started work with it, now after I did something it became three, _sync:user: appeared but I dont get what it is :
My serviceconfig file is :
{
“log”: [“HTTP+”], “adminInterface”: “http://couchbaseServerIP:4985”, “interface”: “http://syncGatewayIP:4984”,
“databases”: {
“sync_gateway”: {
“server”: “http://couchbaseServerIP:8091”,
“users”: {
“GUEST”: {“disabled”: false, “admin_channels”: [“*”] }
}
}
}
}
I want all my docs in default bucket to be synced here. am I doing something wrong with the part I wrote in bold?? My boss said sync_gateway’s IP is different from couchbase server’s IP, shouldnt I use it there also? When I replace them with 127.0.0.1:4984 and127.0.0.1:4985 it just stays lke that:
2016-04-15T13:21:13.741+03:00 Starting server on 127.0.0.1:4984 …
The appearance of the _sync docs means that Sync Gateway has successfully connected to the Couchbase server bucket.
The error regarding colons is caused by the aminInterface and interface values, these should not include the http:// protocol, also to be clear these must point to the IP address of the local server Sync Gateway is running on, not the IP that Couchbase Sever is running on.
From your post try a serviceconfig.json like this:
FATAL: Failed to start HTTP server on syncGatewayIP:4985: listen tcp syncGatewayIP:4985: bind: The requested address is not valid in its context. – rest.(*ServerConfig).serve() at config.go:591
@andy SORRY for asking too much but gotta say that : mobile side will be handled by some other guys here, my only duty now is to carry my docs from default bucket to sync_gateway bucket and keep these two synchronized… I guess I am struggling with more than I should??
Because my boss just came in and said I shouldn’t be using sync_gateway.exe and all other stuff, it’s already connected and the rest is mobile guys’ thing. Should I write my problem with .net tags or am I in the right place? Because nothing I’ve been doing in this 2 days worked for me, about carrying my docs!
Have you read the docs? The documentation of the config file, linked from the main setup page @adamf pointed you to earlier, shows the format of the file including the "interface" and "adminInterface". This could have saved you a lot of trouble.
@jens One more thing, should I be using sync_gateway’s config file to create users? Because I need to create channels and roles so I can’t do that without creating users. But when I look at the documentation it shows codes starting with “curl” and I don’t know what that is. I only use .net SDK and couchbase console, ios and android entegration will be done by someone else. So, could you help me about creating users with the config file? Like, with a sample code or something else?
I added 2 users by httpie, like : http PUT :4985/db/_user/ios name=ios password=1234
now I need to create channels and give users authorization. problem is, I really couldn’t get the idea of channels. In my sync_gateway bucket, my docs have this property:
"channels": [
null,
null,
null,
null
]
How should I create channels? Should I go to views tab and create multiple channels, is that the way? Because there is a “channels” view in my sync_gateway’s production views and there are so many mapping codes in it but I didn’t create it. This is also what I should do? Or what? Also, when I create channels, will I change these "null"s by hand? Thanks!
@andy I read all the docs! Also, mobile applications parts mean nothing to me because I have no idea about ios or android programming. I won’t do that parts at all, someone else will. So all I’m saying is, these docs don’t give any information about “creating” channels, they just show how to use and do things on “created” channels. Hence I’m stuck at the very beginning. My above questions are all about the fundamentals of creating channels and how to shape them in my head. Should I think of them as regular views, or something etc… Thanks again!