Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Improve fuse docs - use the credentials stored in file
Jakub Novak13c778becbc0
diff --git a/apps/docs/src/app/guide/connect-bucket/page.mdx b/apps/docs/src/app/guide/connect-bucket/page.mdxindex 3f52c4640..a0c845187 100644--- a/apps/docs/src/app/guide/connect-bucket/page.mdx+++ b/apps/docs/src/app/guide/connect-bucket/page.mdx@@ -94,8 +94,15 @@ Similarly to the Google Cloud Storage, the actual mounting of the bucket is doneimport { Sandbox } from 'e2b'const sandbox = await Sandbox.create({ template: '<your template id>' })-await sandbox.filesystem.makeDir("/home/user/bucket")-const process = await sandbox.process.start("s3fs <flags> <bucket-name> /home/user/bucket", { envVars: { AWS_ACCESS_KEY_ID="<AWS_ACCESS_KEY_ID>", AWS_SECRET_ACCESS_KEY="<AWS_SECRET_ACCESS_KEY>"} })+await sandbox.filesystem.makeDir('/home/user/bucket')+++// Create a file with the credentials+// If you use another path for the credentials you need to add the path in the command s3fs command+await sandbox.filesystem.write('/root/.passwd-s3fs', '<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>')+await sandbox.process.startAndWait('sudo chmod 600 /root/.passwd-s3fs')++const process = await sandbox.process.start('sudo s3fs <flags> <bucket-name> /home/user/bucket')const output = await process.wait()if (output.exitCode) {throw Error(output.stderr)@@ -107,7 +114,13 @@ from e2b import Sandboxwith Sandbox(template="<your template id>") as sandbox:sandbox.filesystem.make_dir("/home/user/bucket")- process = sandbox.process.start("s3fs <flags> <bucket-name> /home/user/bucket", env_vars={"AWS_ACCESS_KEY_ID": "<AWS_ACCESS_KEY_ID>", "AWS_SECRET_ACCESS_KEY": "<AWS_SECRET_ACCESS_KEY>"})++ # Create a file with the credentials+ # If you use another path for the credentials you need to add the path in the command s3fs command+ sandbox.filesystem.write("/root/.passwd-s3fs", "<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>")+ sandbox.process.start_and_wait("sudo chmod 600 /root/.passwd-s3fs")++ process = sandbox.process.start("sudo s3fs <flags> <bucket-name> /home/user/bucket")output = process.wait()if output.exit_code:raise Exception(output.stderr)@@ -129,7 +142,7 @@ To allow the default user to access the files add the following flag:## Cloudflare R2-For Cloudflare R2 we can use very similar setup as for S3. The `Dockerfile` is the same as for S3. The mounting is slightly different, we need to save the credentials to the file, also we need to specify the endpoint for R2.+For Cloudflare R2 we can use very similar setup as for S3. The `Dockerfile` is the same as for S3. The mounting is slightly different, we need to specify the endpoint for R2.<CodeGroup isRunnable={false}>```js {{ language: 'js' }}@@ -140,10 +153,11 @@ const sandbox = await Sandbox.create({ template: '<your template id>' })await sandbox.filesystem.makeDir('/home/user/bucket')// Create a file with the R2 credentials-await sandbox.filesystem.write('/home/user/.r2-credentials', '<R2_ACCESS_KEY_ID>:<R2_SECRET_ACCESS_KEY>')-await sandbox.process.startAndWait('sudo chmod 600 /home/user/.r2-credentials')+// If you use another path for the credentials you need to add the path in the command s3fs command+await sandbox.filesystem.write('/root/.passwd-s3fs', '<R2_ACCESS_KEY_ID>:<R2_SECRET_ACCESS_KEY>')+await sandbox.process.startAndWait('sudo chmod 600 /root/.passwd-s3fs')-const output = await sandbox.process.startAndWait('sudo s3fs -o passwd_file=/home/user/.r2-credentials -o url=https://<ACCOUNT ID>.r2.cloudflarestorage.com <flags> <bucket-name> /home/user/bucket')+const output = await sandbox.process.startAndWait('sudo s3fs -o url=https://<ACCOUNT ID>.r2.cloudflarestorage.com <flags> <bucket-name> /home/user/bucket')if (output.exitCode) {throw Error(output.stderr)}@@ -156,10 +170,11 @@ with Sandbox(template="<your template id>") as sandbox:sandbox.filesystem.make_dir("/home/user/bucket")# Create a file with the R2 credentials- sandbox.filesystem.write("/home/user/.r2-credentials", "<R2_ACCESS_KEY_ID>:<R2_SECRET_ACCESS_KEY>")- sandbox.process.start_and_wait("sudo chmod 600 ~/.r2-credentials")+ # If you use another path for the credentials you need to add the path in the command s3fs command+ sandbox.filesystem.write("/root/.passwd-s3fs", "<R2_ACCESS_KEY_ID>:<R2_SECRET_ACCESS_KEY>")+ sandbox.process.start_and_wait("sudo chmod 600 /root/.passwd-s3fs")- process = sandbox.process.start("sudo s3fs -o passwd_file=/home/user/.r2-credentials -o url=https://<ACCOUNT ID>.r2.cloudflarestorage.com <flags> <bucket-name> /home/user/bucket", env_vars={"AWS_ACCESS_KEY_ID": "<R2_ACCESS_KEY_ID>", "AWS_SECRET_ACCESS_KEY": "<R2_SECRET_ACCESS_KEY>"})+ process = sandbox.process.start("sudo s3fs -o url=https://<ACCOUNT ID>.r2.cloudflarestorage.com <flags> <bucket-name> /home/user/bucket")output = process.wait()if output.exit_code:raise Exception(output.stderr)