teleclimber / Dropserver

An application platform for your personal web services. https://dropserver.org
Apache License 2.0
42 stars 1 forks source link

Vagrantfile for testing? #90

Closed ocdtrekkie closed 9 months ago

ocdtrekkie commented 1 year ago

The entire list under Running ds-host takes a bit more work: is a bit steep, and I'd like to just kinda spin it up to play. I am not sure if I'd be able to assemble this myself (maybe!), but it would probably be really useful if there was a Vagrantfile I could run that would setup ds-host at a localhost:5050 URL for me to try out.

We hit some weird issues with using .localhost, and it might make sense to make local.dropserver.org and .local.dropserver.org point to 127.0.0.1 so people could use http://local.dropserver.org:5050 and the wildcard DNS to still work. (I could use one of these that's already stood up for testing this, but if this was something you found useful or interesting, it would probably make sense to have a Dropserver-branded address.)

ocdtrekkie commented 1 year ago

To be clear: I am happy to make a first pass at assembling this, but I wanted to propose it first.

teleclimber commented 1 year ago

Yes it's a bit steep. It's also still very much in flux. Right now I'm working on negating the need for a wildcard cert and instead automatically obtain each subdomain as needed (although you could still use a wildcard if you wanted).

It would be great to have something that helps tinkerers get going faster. If you're willing to take a stab at a vagrant file I'd like to see it. For now let's leave dropserver.org out of it. We can use dropserver.devel or something like that.

Thanks!

ocdtrekkie commented 1 year ago

I have an existing domain I can use for testing, I will let you know what I accomplish.

Do also note that through services like https://crt.sh not using a wildcard can actually leak information about what subdomains are accessible on a given domain, so wildcards are probably preferable for obscurity+security purposes.

teleclimber commented 1 year ago

Yes sadly I know about that. DNS and TLS are just not good for personal servers. It definitely is a tradeoff, but self-hosters can make their own choice (you'll be able to do either one or some combination with multiple domains).

ocdtrekkie commented 1 year ago

So I got it to build, and when running, I got this streaming endlessly until I killed it:

    default: Admin Email: Key: '' Error:Field validation for '' failed on the 'required' tag
    default: Admin Email: Key: '' Error:Field validation for '' failed on the 'required' tag
    default: Admin Email: Key: '' Error:Field validation for '' failed on the 'required' tag
ocdtrekkie commented 1 year ago

You can see my work so far here: https://github.com/ocdtrekkie/Dropserver/commit/7009b5175990063b2909c4363fc87603dc77cbb1

teleclimber commented 1 year ago

/dropsrv/dist/bin/ds-host -config=/home/dev/ds-config.json -migrate

That command is interactive. It asks for admin's email and password. I do it this way because I don't want admin credentials in any config files or CLI arguments.

Is there a way for vagrant to deal with interactive prompts? If not I'm open to other ways of setting the initial password for the admin so that non-interactive installs are possible.

ocdtrekkie commented 1 year ago

I don't think there's any good way to do an interactive CLI command. I can ssh into the VM and run it manually so I can try out Dropserver for now, but telling people they need to ssh into the VM before trying to run it to run a command is non-ideal.

Our solution for production use entails a setup wizard within the web interface, and we give the user a randomly-generated URL in the CLI which has permission to access it. For development mode, we autogenerate some accounts like Alice (admin account), Bob, and Dave, which have no password at all.

teleclimber commented 1 year ago

I like the idea of a randomly generated url to set up the system. Will work on that.

ocdtrekkie commented 1 year ago

So first of all... -migrate doesn't appear to be the interactive step!

Second, Field validation is still failing on me, for non-specific reasons.

vagrant@localhost:~$ sudo /dropsrv/dist/bin/ds-host -config=/home/dev/ds-config.json -migrate
ds-host version: v0.8.0
GetSchema num table is 0
Completed migration step: up 1905-fresh-install
Completed migration step: up 2203-sandboxusage
schema after migration: 2203-sandboxusage

vagrant@localhost:~$ sudo /dropsrv/dist/bin/ds-host -config=/home/dev/ds-config.json
ds-host version: v0.8.0
There are currently no admin users, please create one.
Admin Email: test@test.com
Password: Password
Key: '' Error:Field validation for '' failed on the 'min' tag
Password: Password2
Key: '' Error:Field validation for '' failed on the 'min' tag
Password:

AH! Made the password longer, probably should be more clear about that requirement:

Password: PasswordPasswordPassword
Please confirm password: PasswordPasswordPassword
Created user.
Made user an admin.

Had to run ds-host a third time before it bound to port 5050, but I'm getting a 404 Not Found there now.

teleclimber commented 1 year ago

So first of all... -migrate doesn't appear to be the interactive step!

Ah bummer sorry. I haven't done a clean install of ds-host in a long time and was going on memory.

but I'm getting a 404 Not Found there now.

Have you tried [dropid.local.sandstorm.io:5050]()?

ocdtrekkie commented 1 year ago

Ah, that works! I assumed there would be something at the root domain.

teleclimber commented 1 year ago

Hola, should you get back into this, here are a few things that have changed:

$ /usr/local/bin/ds-host -config=/etc/dropserver.json -migrate

Hope that helps. Thank you!