YunoHost-Apps / gotosocial_ynh

GoToSocial package for YunoHost: an ActivityPub social network server, written in Golang.
https://gotosocial.org
Other
10 stars 5 forks source link

Expose `account-domain` setting with suitable warnings #61

Open ndarilek opened 1 year ago

ndarilek commented 1 year ago

Hey, thanks for packaging this.

I can take a crack at this one myself in the coming weeks, but I don't have a YNH test environment set up under Windows, and it seems simple enough for anyone who already has somewhere to test changes while developing.

I'd like to expose the following setting:

# String. Domain to use when federating profiles. This is useful when you want your server to be at                                                                       
# eg., "gts.example.org", but you want the domain on accounts to be "example.org" because it looks better                                                                 
# or is just shorter/easier to remember.                                             
#                                                                                    
# To make this setting work properly, you need to redirect requests at "example.org/.well-known/webfinger"                                                                
# to "gts.example.org/.well-known/webfinger" so that GtS can handle them properly.   
#                                                                                    
# You should also redirect requests at "example.org/.well-known/nodeinfo" in the same way.                                                                                
# An empty string (ie., not set) means that the same value as 'host' will be used.   
#                                                                                    
# DO NOT change this after your server has already run once, or you will break things!                                                                                    
#                                                                                    
# Examples: ["example.org","server.com"]                                             
#                                                                                    
# Please read the appropriate section of the installation guide before you go messing around with this setting:                                                           
# https://docs.gotosocial.org/installation_guide/advanced/#can-i-host-my-instance-at-fediexampleorg-but-have-just-exampleorg-in-my-username                               
#                                                                                    
# Default: ""                                                                        
account-domain: ""                                                                   

Right now I have a few custom Nginx configurations partially redirecting my main YNH-hosted domain to a remote Friendica instance, using the above redirected paths, but Friendica doesn't let me specify a canonical profile domain. It would be great if this option was exposed to YNH, with suitable warning text telling folks they're on their own for managing whatever domain redirects they set up. I'm happy with it just being a string, and if possible, including the links to the installation guide so installers know what they're getting into.

I think it's important because it looks like it can't/shouldn't be changed after installation. So even if I wanted to change it, once the app is installed it's too late.

Thanks again. Happy to test any changes on my production instance, I just don't have anything set up for development.

OniriCorpe commented 1 year ago

Hi @ndarilek!

This should be available with the upcoming packaging of the v0.7.1 (see #65), but only for fresh installs (since changing domain name parameters breaks GTS) ^w^

OniriCorpe commented 1 year ago

the 'account_domain' stuff was breaking the CI tests 😣 after a lot of work trying to get around this, I cannot continue with the "account-domain" implementation

what it would take to make it work:

I'm sorry @ndarilek but it won't be for this time :/

ndarilek commented 1 year ago

Awesome, thanks for trying. Would it be possible to just support the config parameter and require the user to configure it themselves?

For example, I have my own well-known.conf that I add to my nginx domain. It forwards Matrix's .well-known to my non-YNH-Hosted Synapse. It also redirects AP endpoints to my Friendica account so my email address 301s to wherever my fediverse account happens to be ATM.

I'm thinking the value would just get added into the template, and the user would have to create their own config file with samples from the readme and suitable warnings about not changing it later. Thoughts?

Thanks again.

OniriCorpe commented 1 year ago

it's difficult because you need to do this configuration before the first launch of GTS

and that the configuration file is rewritten at each update from the template and the arguments loaded in the update script

so a parameter added manually would be overwritten at each update

and if I put an argument in the installation and update files, it is not accessible to the user without going through the input fields at installation so I am obligated to make an user input at installation, so I have to take it into account during automatized tests

so, for now, I'm stuck and I can't do it without a big gross hack that would then have to be maintained over time and can break anything at any time

and since I'm forced to take the CI into account, I'm also stuck because it limits me to 2 domain names and no matter how I do it, it ends up in a nginx configuration conflict (because of the possibility of installing multiple instances of GTS)

ndarilek commented 1 year ago

Understood. Thanks for taking the time to explain.

OniriCorpe commented 1 year ago

that the ynh_add_nginx_config function can take a domain name and a configuration template as parameters

I have started (and maybe finished) to do this I'll have to check my work when I have some energy and propose its integration in the yunohost's core

ndarilek commented 1 year ago

This feature is something I'd really like to have.

Is there anything I can do to help, up to and including finishing the work you've started in core? I'm not new to development, just to working on YNH, so if it's far enough along but just needs a push over the finish line then I'd be willing to try taking it over and reaching out to other core developers for help.

There are a lot of Fediverse projects that either have or want this feature, so it'd be nice if it could be slotted into YNH.

Thanks.

rodneyrod commented 4 months ago

Heyo, been looking at this and how Synapse does it via the .well-known dir, if this is all that's needed for GTS it might be worth copying some of the logic from there. The vars $domain and $server_name are picked up and can be set separately during the install script process https://github.com/YunoHost-Apps/synapse_ynh/blob/master/scripts/install#L195C1-L198C63