These are chat archives for ushahidi/Community

26th
Jul 2017
Kenji
@Kenji-K
Jul 26 2017 18:08
Say, I've made an Ushahidi API deployment following the instructions on this manual https://ushahidi.s3.amazonaws.com/downloads/community_docs/Ushahidi_Platform_v3_Manual.pdf, and these instructions (https://www.ushahidi.com/support/configure, https://www.ushahidi.com/support/install-ushahidi). I want to enable mobile access to this deployment, and have been advised to supply a config.json, but I am not aware as to where to put it. I've put it at the root of platform/httpdocs, and set the headers to be served with the config.json, but my deployment still won't recognize it.
I am serving it at the root level at the moment, like so http://example.com/config.json to no avail, but the API to access the URL seems to be http://example.com/api/v3/
where and how should I serve this file?
Ushbot
@ushbot
Jul 26 2017 18:43
[David Losada, Ushahidi] config.json is usually supplied from a virtual host with the platform client side installed . Anyway, since you didn’t install it, the API virtual host should be ok too. What are the contents of the JSON file ? is the API working? (i.e. http://example.com/api/v3/config providing a valid result)
[Dale Zak, Ushahidi] Kenji-K, sounds like a CORS issue, the mobile app currently requires the config.json to have that enabled. I'm hoping to remove that requirement soon, so you won't have to do anything special with the config.json.
Kenji
@Kenji-K
Jul 26 2017 18:53
Yes, the API seems to be working fine. I'll link you directly to my test environment http://ec2-35-163-132-15.us-west-2.compute.amazonaws.com/api/v3/config I'm serving the config.json directly at http://ec2-35-163-132-15.us-west-2.compute.amazonaws.com/config.json mostly because I had no idea what else to try, but as you can see on the file, it has the CORS headers on it.
Ushbot
@ushbot
Jul 26 2017 19:02
[Dale Zak, Ushahidi] @will or @davidlosada do you remember what we had to do regarding CORS for config.json so the mobile app could read it?
Ushbot
@ushbot
Jul 26 2017 19:08
[David Losada, Ushahidi] @dale the app tries https by default to reach the API right?
[David Losada, Ushahidi] the CORS headers seem to be fine , just this in the config.json: `backend_domain: "ec2-35-163-132-15.us-west-2.compute.amazonaws.com",`
[David Losada, Ushahidi] complete config.json contents: `\
[Dale Zak, Ushahidi] Try changing it from backend_domain, to backend_url with the full URL to the API location. The backend_domain was only meant to be used for ushahidi.io deployments because at deploy time the scripts do not know the final API destination.
Kenji
@Kenji-K
Jul 26 2017 19:37
okay, I've modified the config.json to include backend_url: http://ec2-35-163-132-15.us-west-2.compute.amazonaws.com/api/v3 but no dice yet. Where should I put it though? Is it in the right spot at the root level?
Ushbot
@ushbot
Jul 26 2017 20:02
[Dale Zak, Ushahidi] Drop the /api/v3, so just `backend_url: http://ec2-35-163-132-15.us-west-2.compute.amazonaws.com`
Kenji
@Kenji-K
Jul 26 2017 20:07
done, no such luck
Ushbot
@ushbot
Jul 26 2017 20:09
[Dale Zak, Ushahidi] Did you remove backend_domain?
Kenji
@Kenji-K
Jul 26 2017 20:10
but I must insist as to the question of where I should put this file
thank you for the help by the way
been trying to deploy for days
Ushbot
@ushbot
Jul 26 2017 20:11
[Dale Zak, Ushahidi] What's your deployment URL?
Kenji
@Kenji-K
Jul 26 2017 20:12
that one right there, no custom domain yet. Unless you mean the web frontend, which I haven't deployed
I did deploy it at one point, seemed to be working fine
but I want to deploy the api and the frontend separately so I disabled the website
Ushbot
@ushbot
Jul 26 2017 20:16
[Dale Zak, Ushahidi] The config.json needs to live in root folder where your public website is, so for example https://my-map.com/config.json.
Kenji
@Kenji-K
Jul 26 2017 20:17
alright, it is sitting in the right spot then.
Ushbot
@ushbot
Jul 26 2017 20:18
[Dale Zak, Ushahidi] If the API is mounted at https://api.my-map.com, then the backend_url in the config.json should be https://api.my-map.com
[Dale Zak, Ushahidi] The reason the config.json is needed, is because deployers can mounted the API at different locations, so the backend_url tells the app where to find the API.
Kenji
@Kenji-K
Jul 26 2017 20:21
Makes sense. At the moment, though, the config.json and the api are hosted in the same place
so the file is effectively pointing to its own server
Ushbot
@ushbot
Jul 26 2017 20:27
[Dale Zak, Ushahidi] Ya, that won't work. In the app, you enter the URL of the deployment, the app uses the config.json to find the location of the API which is different than the website.
[Dale Zak, Ushahidi] Are you trying to add your deployment into the main Ushahidi app? Or trying to whitelabel your own app?
Kenji
@Kenji-K
Jul 26 2017 20:34
I'm attempting to whitelabel
but first just see if I can reach the deployment with the main app
I think you just answered the deeper issue here, but I'll wait for your reply anyway
Ushbot
@ushbot
Jul 26 2017 20:54
[Dale Zak, Ushahidi] You'll need to make sure your deployment is up and running, it wouldn't work without it.
Kenji
@Kenji-K
Jul 26 2017 20:55
by deployment you mean the API right? The web UI shouldn't factor into this
am I understanding correctly?
Ushbot
@ushbot
Jul 26 2017 21:00
[Dale Zak, Ushahidi] Unfortunately you'll need the web UI running which hosts the config.json, and the API running as well.
[Dale Zak, Ushahidi] The app currently is not developed to rely only on the API, still dependent on the config.json file of the web UI.