Skip to content

Commit

Permalink
docs: howto AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaquiery committed Jun 26, 2024
1 parent 093ea71 commit 63dd8d9
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/source/GettingStarted.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
######################################################################################
Getting started
Tutorial: Getting started
######################################################################################

This guide will help you get set up to use Galv.
Expand Down
146 changes: 146 additions & 0 deletions docs/source/HowToAWS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
######################################################################################
How-to: Set up AWS S3 for Galv
######################################################################################

Galv servers usually provide a limited amount of storage to each Lab.
To store files exceeding this quota, you can set up an AWS S3 bucket for your Lab,
and any Teams and Harvesters in your Lab will be able to store data there.

The basic steps are:

#. Create an AWS account
#. Create an S3 bucket
#. Configure the bucket CORS settings to allow Galv to access it
#. Create an IAM user with access to the bucket
#. Set up the AWS credentials in Galv

Create an AWS account
==================================================================================

If you don't already have an AWS account, you can create one at https://aws.amazon.com/

Create an S3 bucket
==================================================================================

Once you've logged in to AWS, go to the S3 service and create a new bucket.
You can find the S3 service in the "Storage" section of the AWS Management Console,
or you can search for it in the search bar.

.. thumbnail:: img/aws-create_bucket.png
:alt: Creating a bucket
:align: center
:title: Creating a bucket

We won't go into the details of creating a bucket here, but you can find more information
in the AWS documentation: https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html

Configure the bucket CORS settings
==================================================================================

Once you've created the bucket, you'll need to configure the CORS settings to allow Galv to access it.
You can do this by clicking on the bucket name in the S3 console, then going to the "Permissions" tab,
then going to the "Cross-origin resource sharing (CORS)" section.

.. code-block:: json
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"HEAD",
"GET"
],
"AllowedOrigins": [
"https://galv-backend-dev.fly.dev",
"https://galv-frontend.dev.fly.dev"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3600
}
]
Set the "AllowedOrigins" to the URLs of your Galv frontend and backend servers.
If you're setting things up in the frontend, the frontend URL is the URL of the site you're on,
and the backend URL can be found by going to the 'Harvesters' tab and reading the text at the top.

Once you've created the bucket, copy its ARN because you'll need it later.
On the main Buckets screen, select the bucket radio button and click 'Copy ARN'.

Create an IAM user with access to the bucket
==================================================================================

Next, you'll need to create an IAM user with access to the S3 bucket.
You'll want this user to have the minimum permissions necessary to access the bucket,
because the credentials will be stored in Galv and could be exposed if the server is compromised.

Galv will need to read and write files to the bucket, but it doesn't need to be able to change bucket settings.

First, go to the IAM service in the AWS Management Console.
Then go to the Policies section under 'Access management' and create a new policy.

.. thumbnail:: img/aws-create_policy.png
:alt: Creating a policy
:align: center
:title: Creating a policy

You can use the JSON editor to create a policy like this:

.. code-block:: json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListBucketMultipartUploads",
"s3:ListBucket",
"s3:PutBucketCORS",
"s3:GetBucketAcl",
"s3:ListMultipartUploadParts",
"s3:PutObject",
"s3:GetObjectAcl",
"s3:GetObject",
"s3:GetObjectTorrent",
"s3:GetBucketCORS",
"s3:GetObjectVersionAcl",
"s3:DeleteObject",
"s3:GetObjectVersion"
],
"Resource": [
"arn:aws:s3:::my-galv-bucket/*",
"arn:aws:s3:::my-galv-bucket"
]
}
]
}
Make sure to replace the entries in "Resource" with the ARN of your bucket, which you can find in the bucket properties.

Next, create a new user in the IAM service and attach the policy you just created to the user.
If you prefer to use Groups, you can create a Group and attach the policy to the Group instead,
then add the user to the Group.

Finally, create an access key for the user and save the Access Key ID and Secret Access Key.
Do that by selecting your user from the Users section and going to the 'Security credentials' tab.
Create an 'Access key' for a 'Third-party service' or 'Application running outside AWS'.
Copy the Access Key ID and Secret Access Key because you'll need to enter them in Galv.

Set up the AWS credentials in Galv
==================================================================================

Finally, you'll need to enter the AWS credentials in Galv so that it can access the S3 bucket.
Click on the 'Additional storage' icon in the navigation bar, then click 'Create new additional storage'.

You can fill out the form using the Access Key ID and Secret Access Key you created in the previous step,
and you'll also need the bucket name and the AWS region the bucket is in.
The 'location' field allows you to specify a path within your bucket where files will be stored.

Fill out the information, make sure the storage is set to 'enabled',
and click the green floppy disc icon to create your storage.

You should now be able to upload files to your S3 bucket from Galv,
and Galv will take care of making sure that the appropriate people can access them.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
project = 'Galv Frontend'
copyright = '2023, Oxford RSE'
author = 'Oxford RSE'
release = '2.0.0'
release = '2.1.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
Binary file added docs/source/img/aws-create_bucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/aws-create_policy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ to provide a modern, responsive, and intuitive user interface to the backend `RE

GettingStarted
UserGuide
HowToAWS
DeploymentGuide
DevelopmentGuide


Backend and Harvester documentation
--------------------------------------------------------------------------------------

The backend and harvester documentation can be found at the following links:

* `Galv Backend <https://galv-team.github.io/galv-backend/>`_
* `Galv Harvester <https://pypi.org/project/galv-harvester/>`_


Indices and tables
======================================================================================
Expand Down
2 changes: 1 addition & 1 deletion docs/tags.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["v2.0.0","main"]
["v2.1.0","main"]
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "galv-client",
"version": "2.0.0",
"version": "2.1.0",
"private": true,
"proxy": "http://app/",
"dependencies": {
"@canvasjs/charts": "^3.7.27",
"@canvasjs/react-charts": "^1.0.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@galv/galv": "2.1.45",
"@galv/galv": "2.2.0",
"@mui/base": "5.0.0-beta.33",
"@mui/icons-material": "^5.10.15",
"@mui/lab": "^5.0.0-alpha.109",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ export const FIELDS = {
...generic_fields,
name: {read_only: false, type: "string", priority: PRIORITY_LEVELS.IDENTITY},
lab: {read_only: true, type: key_to_type(LOOKUP_KEYS.LAB), priority: PRIORITY_LEVELS.CONTEXT},
quota: {read_only: true, type: "number", priority: PRIORITY_LEVELS.SUMMARY},
quota_bytes: {read_only: true, type: "number", priority: PRIORITY_LEVELS.SUMMARY},
bytes_used: {read_only: true, type: "number", priority: PRIORITY_LEVELS.SUMMARY},
priority: {read_only: false, type: "number", priority: PRIORITY_LEVELS.SUMMARY},
enabled: {read_only: false, type: "boolean", priority: PRIORITY_LEVELS.SUMMARY},
Expand Down

0 comments on commit 63dd8d9

Please sign in to comment.