libertysoft3 / saidit

The reddit open source fork powering SaidIt
https://saidit.net
Other
228 stars 40 forks source link

Accessing from outside resolutes to reddit.local #58

Closed outlaw6 closed 4 years ago

outlaw6 commented 5 years ago

When I install on AWS and try to access via public IP the browser translates the IP to

https://reddit.local/s/home

And obviosly cannot open that website because there is no such domain.

How can I fix this>?

I was trying to identify the REDDIT_DOMAIN and change value but with no luck.

Any help?

outlaw6 commented 5 years ago

I solved this by changing install/developments.update and changing host = public IP

But new prob arose, cannot register or sign in?

libertysoft3 commented 5 years ago

Cool, that's neat that your ip hack worked. Typically you would modify your hosts file (on your machine, not the server) to resolve reddit.local to the correct ip.

I worry that this is actually causing your issue though. Can you give me the error that happens on registration, by checking /var/log/syslog? You can watch it in real time like:

$ sudo tail -f /var/log/syslog

reddit.local is assigned to your self-signed SSL cert, another reason not to use the ip. So I would stick with reddit.local unless you want to buy a real domain. In that case you'd change:

domain
oauth_domain
https_endpoint

in /home/reddit/src/reddit/r2/development.update

outlaw6 commented 5 years ago

Thanks for the reply, Yeah, it gave me huge headache to make it work. This is the output of the log when I try to register. Please mind that in the browser I get: an error occurred (status: 0)

And this is the output from /var/log/syslog when I try to register.

Aug 17 08:58:01 ip-172-31-32-128 CRON[27829]: (root) CMD (/sbin/start --quiet reddit-job-rising) Aug 17 08:58:01 ip-172-31-32-128 CRON[27833]: (root) CMD (/sbin/start --quiet reddit-job-broken_things) Aug 17 08:58:02 ip-172-31-32-128 reddit-job-rising: Warning: g.media_domain == g.domain. This may give untrusted content access to user cookies Aug 17 08:58:02 ip-172-31-32-128 reddit-job-rising: Warning: g.oauth_domain == g.domain. CORS requests to g.domain will be allowed Aug 17 08:58:02 ip-172-31-32-128 reddit-job-broken_things: Warning: g.media_domain == g.domain. This may give untrusted content access to user cookies Aug 17 08:58:02 ip-172-31-32-128 reddit-job-broken_things: Warning: g.oauth_domain == g.domain. CORS requests to g.domain will be allowed Aug 17 08:58:02 ip-172-31-32-128 reddit-job-broken_things: Overriding g.from r2.lib.utils import utils; utils.find_recent_broken_things(delete to True) Aug 17 08:58:02 ip-172-31-32-128 reddit-job-broken_things: ip-172-31-32-128:27840 started 2028031 at 08:58:02 (took 0.14s) Aug 17 08:58:02 ip-172-31-32-128 reddit-job-rising: ip-172-31-32-128:27839 started 2028031 at 08:58:02 (took 0.14s)

I know this is meant for local, but I need (want) to try make this work to be accessible form the outside. I thought maybe the haproxy was giving it a hardtime? Anyway, I would really appreciate help on this.

Also, mind that if I execute the inject script to fill it with some dumb data, it works. There is lots of data on the website, which would imply the db works. So the question remains, why it wont allow it to write in the db from the browser?

Thanks.

libertysoft3 commented 5 years ago

I know this is meant for local, but I need (want) to try make this work to be accessible form the outside.

If you want to overcome having to modify the hosts file to resolve 'reddit.local', you either need to buy/get a domain name, or use the domain name that your hosting company probably assigned to your server, and update your SSL cert accordingly. The SSL cert must be assigned to a domain name, not an ip address. The SSL stuff is managed by nginx, before the request is sent to HAProxy.

As for the error you are getting, sorry but it's not reflected in this log content that you posted. Are you still using your ip hack? I would undo that until you are satisfied that everything is working with 'reddit.local'.

The test data inject script is kinda direct to the DB without having to send requests through nginx and HAProxy and the rest. But yes it does indicate that you are somewhat working.

libertysoft3 commented 4 years ago

I think you can get a free domain name here: https://www.freenom.com/en/pricechart.html

libertysoft3 commented 4 years ago

Closing, too much work to implement this, there are easy and free workarounds