digitalocean/pixels-to-cloud
Rust
Captured source
source ↗digitalocean/pixels-to-cloud
Description: pixels-to-cloud is a photo-editor app that aims to inspire developers to create high-performance, scalable, distributed systems.
Language: Rust
License: MIT
Stars: 10
Forks: 1
Open issues: 0
Created: 2024-06-07T09:31:46Z
Pushed: 2024-07-09T12:15:01Z
Default branch: main
Fork: no
Archived: no
README:
pixels-to-cloud
pixels-to-cloud is a photo-editor app that aims to inspire developers to create high-performance, scalable, distributed systems. By leveraging technologies such as gRPC and DigitalOcean Object Storage (Spaces), this project showcases the potential of modern tech stacks to build robust and efficient application architectures.
Here is the overview of the architecture:
Prerequisites
- [Rust](https://www.rust-lang.org/tools/install)
- Includes Cargo: Rust package manager
- [DigitalOcean Account](https://cloud.digitalocean.com/registrations/new?refcode=f6fcd01aaffb)
- To create and access DO Object Storages: Spaces
- [Rclone](https://rclone.org/)
- Spaces sync across different geographies
Setting Up DigitalOcean Spaces & Rclone
To create three DigitalOcean Spaces instances in NYC, AMS, and SYD, follow these steps:
1. Log in to Your DigitalOcean Account:
- Go to DigitalOcean and log in.
2. Navigate to Spaces Object Storage:
- Access the Spaces section: DigitalOcean Spaces.
3. Create Spaces across three Data Centers:
- Choose data center regions:
- NYC: "New York(nyc3)"
- AMS: "Amsterdam(ams3)"
- SYD: "Sydney(syd1)"
- Name your Spaces (e.g.,
pixbox-nyc,pixbox-ams,pixbox-syd). - Adjust settings as needed and click "Create a Spaces Bucket".
- For more details, refer to the DigitalOcean Spaces Documentation.
4. Generate Spaces Access Keys:
- Go to the API section to generate new Spaces Keys.
- Copy the Access Key and Secret Key and store them securely.
5. Configure Spaces Access using Rclone:
- Run
rclone configto set up the rclone configuration - Your configuration file should be similar to the one below:
# Rclone configuration example [pixbox-ams] type = s3 provider = DigitalOcean env_auth = false access_key_id = secret_access_key = endpoint = ams3.digitaloceanspaces.com acl = [pixbox-syd] type = s3 provider = DigitalOcean env_auth = false access_key_id = secret_access_key = endpoint = syd1.digitaloceanspaces.com acl = [pixbox-nyc] type = s3 provider = DigitalOcean env_auth = false access_key_id = secret_access_key = endpoint = nyc3.digitaloceanspaces.com acl =
Run the demo
git clone https://github.com/digitalocean/pixels-to-cloud.git cd pixels-to-cloud
There are three main components:
- [
client](./src/client.rs) - [
server](./src/server.rs) - [
synchronizer](./scripts/spaces-sync.sh)
For ease of usage, we have created a [Makefile](Makefile) with all the necessary commands to build/run the project.
Start the Server
# The server will start listening on localhost:9001 make run # The above make command translates to cargo run --release --bin server
Start the Rclone Synchronizer
./scripts/spaces-sync.sh # Example ./scripts/spaces-sync.sh ./images/edited
Using the Client
# The client is used to upload the image to be edited to the server. make upload # The above make command translates to cargo run --bin client upload --imgpath
Acknowledgments
- Photon: Image Processing Library in WebAssembly/Rust
- gRPC Community
- [Cape Breton](./images/marg-cape-breton.jpg): Photo Courtesy - Margaret MacAfee