Digital Ocean Spaces (S3) "unable to sign request without credentials set"

Trying to setup Digital Ocean Spaces for S3 storage.

I get this when I try to run backups…

Same when I upload photos…

I have this setup…

…but I’m not sure how to test if those actually work. I don’t know these systems very well. This is just for a small friends group forum.

Initially I had the below live, but I had to comment it back out on the app.yml because it wouldn’t rebuild with those lines live. Not sure if it’s still necessary or not at this point…

I’ve manually uploaded a file from the Digital Ocean Spaces admin area, set it to public, and I’m able to pull it up through a browser.

I also manually created the “*****-backups” folder in DO Spaces.

Here’s an example of how little I know. I’m stuck here and I don’t really know why. Somehow I’ve backed myself out of something and I’m not sure how to get back.

image
For some reason what’s usually in /var/discourse now seems to be in /var/www/discourse

I’m just stuck at this point though. I’ve searched through the forum and not found anything that will solve it. I’ve spent a day in the same loop. This is along the same lines, but it’s actual AWS S3 and not DO Spaces (S3)…

Any assistance would be appreciated. Thank you.

לייק 1

You’re missing the use_s3 setting that’s recommended on the topic you linked.

You should copy paste those settings from the topic you linked rather than trying to type them. You need colon not equal.

If you’re seeing stuff at /var/www/discourse you’re inside the container. You need to exit to get back to the os.

לייק 1

Thanks for the feedback.

This is in there. I guess it just doesn’t show with that other command. I had the CDN commented out because it said there were issues with it, so I was trying to isolate that out. Especially because I’m not 100% sure that the URL is the correct one since the example was a custom domain instead of the default Spaces one. Maybe that was a bad idea to try to isolate it out. I was trying a lot of things.
Here’s the full setting…

Not 100% positive, but I’m pretty sure I did copy/paste. I usually do.

I did have an error when trying to rebuild, so I went back in and commented these back out…


I’m going to try to enable those again and run it.

Ah, ‘exit’

That’s what I was looking for. Thank you.

What am I missing on this S3 part?

I removed the commenting to make it live…

EDIT: I just realized that this has a typo in that last line. Not sure how I messed that up.

I saved and tried to rebuild and I get this…

That security warning was a new one. I ran to hopefully resolve that…

chmod o-rwx containers/app.yml

I verified the docker version…

docker --version

Looking in to how to update that. I thought rebuilding it would update that, but maybe not.

That didn’t solve it. Even with the old commented out and that copied/pasted in…

I still get an error on rebuild…


”did not find expected key while parsing a block mapping at line 109 column 3”

I’m not sure what key it’s referring to.

Access and secret key settings are in the settings. I’m not sure how to test to make sure those settings actually work, but they’re in there.

Seems like I’m close, but…

After rebuild, it was just stuck in thinking…

Left it that way a few hours. No change.

Commented out the CDN and it gave me the “line 109” error again. Commented out the bottom area also and rebuilt. I can get into the forum, but I can’t upload any attachments still.

On rebuild, it seems to hang here for a while.


Not sure it matters since it eventually gets by it without any action.

With the CDN and bottom area commented out, I can get the forum to work, but I still have the original issue…

Not sure what I’m missing.

After rebuild, it was just stuck in thinking. At first I thought it might be transferring everything or working in the background, so I let it…

Left it that way a few hours. No change.

I checked Spaces and no files were uploaded, so I guess it was just hung on something.

Commented out the CDN and it gave me the “line 109” error again.

Commented out the bottom area also and rebuilt. I can get into the forum, but I can’t upload any attachments still.

On rebuild, it seems to hang here for a while but it eventually gets by it without any action, so I’m not sure that matters at all..

With the CDN and bottom area commented out, I can get the forum to work, but I still have the original issue…

Not sure what I’m missing. I gave up left all of the S3 settings commented out for now.

SIDENOTE: Is there a command to update the docker? I think I normally do this through the admin area, but it’s not prompting me to update from 24.0.2. Not sure how big of an issue that is. I think the current is 24.0.7.

I’m not sure if the admin area settings override the app.yml settings or vice versa, but here are those settings JIC…

I’m not clear if the S3 and CDN URLs are supposed to include the bucket name or not. Also not positive that they’re supposed to be identical links.

Hoping someone notices something simple. If you’ve read this far, thanks again!

Are you using the social ocean cdn?

If it hadn’t loaded in 30 seconds, it probably won’t. But you don’t need to wait that long. You can look at the network tab in the browser development tools and see what’s not loading.

Not sure what social ocean CDN is, but I’m just trying to use the CDN that’s built into Spaces.

Sorry, that was “Digital Ocean”.

The message I quoted says that you shouldn’t do that because it doesn’t work.

If you want more help from me my email address is in my profile

לייק 1

OK. This is so odd.

SOMETHING is working now. I thought I had it all commented out (turned off) and uploaded a photo yesterday to make sure it worked again. I checked the path to it this morning and it’s using the… CDN I guess?

https://XXXXXXX-storage.sfo3.digitaloceanspaces.com/optimized/2X/9/9b9fdb3eb27831650752b848363ea2a1a66ce137_2_375x500.jpeg

I checked in Spaces and it has some images in there…


It appears that images are working correctly now. The only thing I can think of is that I unchecked “S3 use IAM profile” in the settings. I’m guessing that’s the key that it was looking for that it stopped looking for. Not sure why I had that checked in the first place. Probably because I really have no clue what I’m doing. :slight_smile:

Still having an issue running backups, but maybe that’s a Droplet space issue. Looks like it doesn’t have enough space to stage it locally before uploading. I’ll dig into that separately now that it appears to be at least connected to the Space.

Thanks Jay, I’ll reach out later this week when I can mess with this friends forum again. Off to pay some bills for a bit.

לייק 1

I had a few minutes while waiting for my SO to get ready, so I thought I’d check space. After thinking more about it, I figured that had to be the issue. I checked with…

df -h

Oh yea, really full. Ran…

docker system prune -a

Ran…

./launcher cleanup

Thanks again Jay.

Sure enough, cleared up over 20GB.

Ran the backup manually and it worked!!!

Now I’m trying to migrate all files from local storage to S3…

rake uploads:migrate_to_s3

Wish me luck! :slight_smile:

לייק 1

Checked a few things this morning while waiting for a meeting to start.

Rake didn’t seem to work, or maybe is still in progress. I can’t tell yet. Space usage went down, but when I checked some old photos manually they still seem to have the old local URL. I’ll have to dig into that more.

Not sure what the difference of rake vs reback is. I assume one is migrating the files and the other is updating the paths in the posts. More to learn.

It’s still using a lot of space in /import (1.4GB) and /uploads (9.2GB). A lot for our small package. I’m trying to offload that to cheaper storage and those are by far the biggest chunks.

Some FYI for anyone that’s setting up the same, this is what it’s using for endpoint URLs…

CDN
https://XXXXXX-storage.sfo3.cdn.digitaloceanspaces.com/original/2X/0/15740f130209eb1a6a4f147076eaa20e70a9772d.zip

ORIGIN
https://XXXXXX-storage.sfo3.digitaloceanspaces.com/original/2X/0/15740f130209eb1a6a4f147076eaa20e70a9772d.zip

The only difference is the .cdn in the URL. I need to update my settings.

From Copilot…
__________

To rebake posts after changing the CDN link in Discourse, you need to run the rebake rake task so that all cooked post HTML gets updated with the new asset URLs.

Here’s the process:


1. Enter the container

cd /var/discourse

./launcher enter app

2. Run the rebake task

rake posts:rebake

This will:

  • Re-render all posts using the current settings (including your new s3_cdn_url).

  • Update cooked HTML so images and uploads point to the CDN.


Optional: Speed it up

If you have a large site, you can run it in batches:

rake posts:rebake[1000]

This rebakes 1,000 posts at a time.


3. Verify

Check a few posts with images or uploads to confirm they now use the CDN URL.

__________
Seems to be running. I’ll check back later.

image

Off to make the donuts.

This runs the rebake, but not just 1,000 at a time. It just runs them all and ignores the [1000] part. Maybe my syntax isn’t quite correct there.

Another reminder for myself as much as anyone else. I was looking for this URL in the menu because I had it backwards ( .cdn.sfo3. instead of vice versa - which obviously broke the SSL). I couldn’t find the setting when searching. Then I found a window that I already had it open. I updated it and tried to save and got this…


I forget that once the settings are added in the app.yml, they disappear from the admin settings menu. Now I remember.

The rebake seemed to have worked, I just had the wrong URL. That’s updating now.

I’m still sitting at under 50 files in my Space storage though, so the file rake isn’t working. :thinking: