Couchbase Mobile (Sync Gateway) sample TODOlite application doesn't replicate; complains _facebook doesn't exist - couchbase

My objective: get https://github.com/couchbaselabs/ToDoLite-iOS syncing with a Couchbase Server and sync gateway on localhost rather than the default demo URL.
I run sync gateway like so: bin/sync_gateway -url http://localhost:8091
And then the only thing I changed in the example is:
-#define kSyncGatewayUrl #"http://demo.mobile.couchbase.com/todolite"
+#define kSyncGatewayUrl #"http://localhost:4984/sync_gateway/"
And when I run
Error: Error Domain=CBLHTTP Code=404 "404 not_found" UserInfo=0x7ff11941fb50 {NSURL=http://localhost:4984/sync_gateway/_facebook, NSLocalizedFailureReason=not_found, NSLocalizedDescription=404 not_found}
How do I fix this?

I solved it. The reason is that I ran sync_gateway without enabling Facebook registration support.
Normally this is done in config.json file. In fact, this configuration file was supplied in ToDoLite all along.
It is crucial that you launch sync_gateway with this configuration file. The README actually states this but in a loose and casual way...
cd ToDoLite-iOS
sync_gateway -url http://localhost:8091 sync-gateway-config.json
NB: I assume above that sync_gateway has been made accessible through $PATH. It's a good idea to do that anyway.
Also, I didn't pay attention to the dbname. So you'll need to replace
#define kSyncGatewayUrl #"http://demo.mobile.couchbase.com/todolite"`
with
#define kSyncGatewayUrl #"http://localhost:4984/todos"
So, what's the complete sequence of steps to get it working?:
If you want to wipe everything on the server, rm -rf Library/Application\ Support/Couchbase and start over. Homebrew cask hides this setting somewhere else where it's hard to reset so a manual install is very recommended.
Install Couchbase Server
Set up login credentials if fresh install; otherwise just login
Create a bucket (a database) with name todos on the cluster. This is the dbname used by TODOLite.
Launch sync gateway. Be sure to pass in the replication URL AND the JSON config file.
bin/sync_gateway -url http://localhost:8091 sync-gateway-config.json; keep sync gateway running
In the TODOLite AppDelegate.m, change kSyncGatewayUrl:
#define kSyncGatewayUrl #"http://localhost:4984/todos". Notice the name of the database is necessary!
(Optionally) Access the administrator interface of the sync gateway by going to http://localhost:4985/_admin/db/sync_gateway/sync. You can set up the sync function here.
In case you're wondering where those port numbers came from, check out
ports Couchbase Server uses
ports Sync Gateway uses
4984 — SG API port
4985 — SG admin server

The default remote sync URL will be defined in different files depending on the version of the project you download (iOS, Android, PhoneGap, and Motion). To find the appropriate string to change simply search through your project for the URL "http://demo.mobile.couchbase.com/todolite" and replace it with the URL of your new sync gateway database.

Related

Unable to launch MapServer through MS4W

I have installed the MS4W map server and when I try to launch the site in the localhost it takes me to the below landing page. I am unable to see the map getting loaded in the page.
Any suggestions?
Besides using the setup.exe installer from https://ms4w.com, you can install MS4W manually as well, using the .zip available there; you can use the steps below to verify your installation either way:
make sure that you installed/extracted MS4W into a root of a drive (for example,
you should have a resulting directory structure such as:
C:/
ms4w
Apache
apps
...
open a command prompt window (use Windows search, enter "cmd", and make sure to
choose "Run as Administrator"
now in Command Prompt, enter:
cd c:/ms4w
then setup the MS4W environment with:
setenv.bat
which should let you know that the MS4W environment is ready:
GDAL, mapserv, Python, PHP, and commandline MS4W tools path set
now we can install the Apache web server:
apache-install.bat
which should display a successful message such as (notice the text "The Apache MS4W Web Server service was started successfully") :
Installing the 'Apache MS4W Web Server' service
The 'Apache MS4W Web Server' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
The Apache MS4W Web Server service is starting.
The Apache MS4W Web Server service was started successfully.
if you have errors, you can check the Apache logs at C:/ms4w/Apache/logs
you can also verify that MapServer is ready at the commandline, with:
mapserv -v
which should display MS4W information such as:
MapServer version 7.6.0-dev (MS4W 4.0.3) OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
TIP: try to now execute other MS4W tools at that same commandline, such as gdalinfo --formats or shp2img etc. (basically you can call any tool now, that lives in C:/ms4w/tools, without ever having to change directory there)
now you are ready to goto your localhost, so open your web browser (Firefox, Chrome, IE) and type: 127.0.0.1 <enter>
you should see the MS4W homepage now in your local browser, with a sample map as well (that is actually a fully configured WMS service served from your local machine, serving Spatialite data), such as: https://ms4w.dev/

PhpStorm - Configuring deployment remote server for debug

I want to debug in a remote server, which is, by the way, a Vagrant machine. Not really a remote server, but this has a peculiar setup: the shared host/vagrant machine folder isn't related to the web server files.
The server is configured with Zend Framework.
I have, locally, to deploy to the machine the following folders (as Zend Framework structure):
/home/user/webStuff/web
Inside web: config, data, module, vendor and public folders
Inside public folder I have the index.php, which handles all server requests.
Following is the server deployment configuration:
When I press "Test SFTP Connection" everything is fine. When I press "Open", the website opens.
And here, is the "Mappings" tab on the deployment configuration
Everything seems OK, here. At least from my point of view.
But when I test the settings, in Run -> WebServer Debug Validation, it gives me "Failed to collect files: Invalid relative file name". I've tried more settings, like placing /web/public in Web path, but with no success.
In Settings -> Languages & Frameworks -> PHP I have a good configuration for the server vagrantmachine.com, with XDebug version correctly displayed.
Also, I've placed the following in xdebug.ini:
xdebug.remote_connect_back = 1
xdebug.remote_enable=1
I've searched and tried a lot, but with no success.
I'm no specialist in these server configuration things, but if you need any information, just ask.
"Deployment path on server" and "Root Path" were wrong.
Like #Eugene Morozov said, I changed the root path to "/opt/webStuff" and deployment path to "/" and it worked out.

Clone Openshift application in scalable

I have an application in Openshift free plan with only one gear. I want to change it to scalabe and take usage of all of 3 free gears.
I read this blog post from openshift and I found that there is a way to do it. I should clone my current application to a new one as a scalable which will use the 2 remaining gears and then I will delete the original application. Thus, the new one will have 3 free gears.
The way that blog suggest is: rhc create-app <clone> --from-app <existing> --scaling
I have the following error: invalid option --from-app
Update
After running the command gem update rhc, I don't have the error above but...A new application with the given name has created with the same starting package (Python 2.7) just like the existing one, but all the files are missing. It actually create a blank application and not a clone of the existing.
Update 2
Here is the structure of the folder:
-.git
-.openshift
-wsgi
---static
---views
---application
---main.py
-requirements.txt
-setup.py
From what we've talked on IRC, your problem was around missing SSH configuration on Windows machine:
Creating application xxx ... done
Waiting for your DNS name to be available ...done
Setting deployment configuration ... done
No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH.
I've double checked it, and it appears to be working without any problem.
The only requirement is to have the latest rhc client and putty or any other
SSH client. I'd recommend going through this tutorial once again and double-check everything to make sure everything is working properly.
Make sure you are using the newest version of the rhc gem with "gem update rhc" to make sure that you have access to that feature from the command line.
The --from-app will essentially do a 'rhc snapshot save & snapshot restore` (amoung other things) as you can see here from the source:
if from_app
say "Setting deployment configuration ... "
rest_app.configure({:auto_deploy => from_app.auto_deploy, :keep_deployments => from_app.keep_deployments , :deployment_branch => from_app.deployment_branch, :deployment_type => from_app.deployment_type})
success 'done'
snapshot_filename = temporary_snapshot_filename(from_app.name)
save_snapshot(from_app, snapshot_filename)
restore_snapshot(rest_app, snapshot_filename)
File.delete(snapshot_filename) if File.exist?(snapshot_filename)
paragraph { warn "The application '#{from_app.name}' has aliases set which were not copied. Please configure the aliases of your new application manually." } unless from_app.aliases.empty?
end
However this will not copy over anything in your $OPENSHIFT_DATA_DIR directory so if you're storing files there, you'll need to copy them over manually.

openshift : need to edit httpd.conf to enable or add directive according to my needs but it's not work

i've build my application on localhost and running it without any error. i choose openshift to host my application code but i have a problem to make it works perfectly like on my localhost.
i want to add directive of AllowEncodedSlashes and set it to On in my apache2 configuration file, i have tried to edit the file from ~/php/configuration/etc/conf/httpd.conf and then restart the server using ctl_all restart. but the result are http error code 400 (Bad Request). before i add this directive into httpd.conf the result are http error code 404, i am just not sure if the changes are in effect or not. or apache is bugging?
is there anyone knows howto make this work for me?
See if you can add it into .htaccess file instead of httpd.conf file. Also the best way to troubleshoot these problems would be by reviewing your application logs for errors. All you have to do is run "rhc tail {appName}" from your client machine (where the rhc client tools are installed). That gives you the current log entries.
To get to the entire log, you'll want to ssh onto the gear(s) on which the language framework/cartridge is installed using this FAQ and run: more ~/{cartridgeID}/logs/*.log
where {cartridgeID} is your framework cartridge like nodejs-0.6, or your embedded cartridge logs like mysql-5.1.
I created a feature request for this. See this Trello card and feel free to vote it up.

gsutil not working in GCE

So when I bring up a GCE instance using the standard debian 7 image, and issue a "gsutil config" command, it fails with the following message:
jcortez#master:~$ gsutil config
Failure: No handler was ready to authenticate. 4 handlers were checked. ['ComputeAuth', 'OAuth2Auth', 'OAuth2ServiceAccountAuth', 'HmacAuthV1Handler'] Check your credentials.
I've tried it on the debian 6 and centos instances and had the same results. Issuing "gcutil config" works fine however. I gather I need to set up my ~/.boto file but I'm not sure what to.
What am I doing wrong?
Using service account scopes as E. Anderson mentions is the recommended way to use gsutil on Compute Engine, so the images are configured to get OAuth access tokens from the metadata server in /etc/boto.cfg:
[GoogleCompute]
service_account = default
If you want to manage gsutil config yourself, rename /etc/boto.cfg, and gsutil config should work:
$ sudo mv /etc/boto.cfg /etc/boto.cfg.orig
$ gsutil config
This script will create a boto config file at
/home/<...snipped...>/.boto
containing your credentials, based on your responses to the following questions.
<...snip...>
Are you trying to use a service account to have access to Cloud Storage without needing to enter credentials?
It sounds like gsutil is searching for an OAuth access token with the appropriate scopes and is not finding one. You can ensure that your VM has access to Google Cloud Storage by requesting the storage-rw or storage-full permission when starting your VM via gcutil, or by selecting the appropriate privileges under "Project Access" on the UI console. For gcutil, something like the following should work:
> gcutil addinstance worker-1 \
> --service_account_scopes=https://www.googleapis.com/auth/devstorage.read_write,https://www.googleapis.com/auth/compute.readonly
When you configured your GCE instance, did you set it up with a service account configured? Older versions of gsutil got confused when you attempted to run gsutil config when you already had service account credentials configured.
If you already have a service account configured you shouldn't need to run gsutil config - you should be able to simply run gsutil ls, cp, etc. (it will use credentials located elsewhere than your ~/.boto file).
If you really do want to run gsutil config (e.g., to set up credentials associated with your login identity, rather than service account credentials), you could try downloading the current gsutil from http://storage.googleapis.com/pub/gsutil.tar.gz, unpacking it, and running that copy of gsutil. Note that if you do this, the personal credentials you create by running gsutil config will essentially "hide" your service account credentials (i.e., you would need to move your .boto file aside if you ever want to user your service account credentials again).
Mike Schwartz, Google Cloud Storage team
FYI I'm working on some changes to gsutil now that will handle the problem you encountered more smoothly. That version should be out within the next week or two.
Mike