Report this

What is the reason for this report?

Local development options for DigitalOcean's Spaces

Posted on October 14, 2024

I want to set up Spaces for my application and would like to be able to develop locally by targetting some local instance. What options do I have to do this?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

I personally would just use the Spaces directly for local development as well.

If you really need a local S3 storage and using the live Spaces bucket is not an option for you, what you could do is to use a service like MinIO which you can run locally:

https://min.io/

It’s lightweight, easy to set up, and works perfectly for simulating S3 storage in your local environment.

They also have a Docker image that you could use:

  1. Pull the MinIO Docker Image: First, pull the MinIO image from Docker Hub:

    docker pull minio/minio
    
  2. Run MinIO in a Docker Container: Now, run MinIO in a container with the following command:

    docker run -p 9000:9000 -p 9001:9001 --name minio \
    -e MINIO_ROOT_USER=minioadmin \
    -e MINIO_ROOT_PASSWORD=minioadmin \
    minio/minio server /data --console-address ":9001"
    

    This will:

    • Expose MinIO on localhost:9000 for the S3 API.
    • Start the MinIO admin console on localhost:9001 for easier management.
  3. Access the MinIO Console: Open the admin console by visiting http://localhost:9001 in your browser and logging in with the following credentials:

    • Username: minioadmin
    • Password: minioadmin
  4. Configure Your Application: In your application, configure the environment variables to point to your local MinIO instance. Here’s an example:

    S3_ENDPOINT=http://localhost:9000
    S3_ACCESS_KEY=minioadmin
    S3_SECRET_KEY=minioadmin
    S3_BUCKET=my-local-bucket
    

You can also check out this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-minio-object-storage-server-in-standalone-mode-on-ubuntu-20-04

Hope that this helps!

- Bobby

Heya,

I’ll also vote for MinIO if you want something for local development, but as Bobby mentioned you can use Spaces directly for local development as well.

Regards

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.