# Google Cloud Storage
If you have the yCrash server application installed across multiple server nodes behind a load balancer then it's mandatory to store the uploaded files in some common storage solutions like Google Cloud Storage (GCS).
By default, uploaded files are stored on the local disk of the machine where the yCrash server application is running. However, the tool also provides the option to store uploaded files in GCS. Some customers may prefer not to store files locally due to space limitations or concerns about availability. If you have the yCrash server installed across multiple instances behind a load balancer, it is essential to store uploaded files in GCS. This ensures that users can access generated reports regardless of the server instance handling their request. For example, if a user uploads a file to server node-1 and another user attempts to access the same report, the load balancer may route the request to server node-2. If the files are stored locally, the second user may encounter an HTTP 404 error. This setup will ensure that uploaded files are stored in GCS, enabling seamless access across all server instances.
Follow these steps to store uploaded files in GCS:
# 1. Create a Service Account:
In your Google Cloud account, create a service account by following the instructions at this link (opens new window).
# 2. Generate a Private Key:
Once the service account is set up, create and download a private key by following the steps outlined here (opens new window).
# 3. Rename and Place the Key File:
Rename the downloaded private key file to storage-gcs.json and place it in the uploadDir directory.
# 4. Configure the Bucket:
Download (opens new window) the provided template file or create a new JSON file named storage-gcs.json. Add the "bucket" property to this file, specifying the name of the GCS bucket where you want to store your files. Below is a sample storage-gcs.json file with the "bucket" property.
Here's a JSON template file with placeholders:
{
"bucket": "YOUR_BUCKET_NAME",
"type": "service_account",
"project_id": "YOUR_PROJECT_ID",
"private_key_id": "YOUR_PRIVATE_KEY_ID",
"private_key": "YOUR_PRIVATE_KEY",
"client_email": "YOUR_CLIENT_EMAIL",
"client_id": "YOUR_CLIENT_ID",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/YOUR_CLIENT_EMAIL"
}
2
3
4
5
6
7
8
9
10
11
12
13
In this JSON: (Make sure to replace these sample values with your actual data)
"YOUR_BUCKET_NAME"should be replaced with the name of your GCS bucket."YOUR_PROJECT_ID"is the placeholder for your Google Cloud project ID."YOUR_PRIVATE_KEY_ID"and"YOUR_PRIVATE_KEY"are placeholders for the service account's private key ID and private key."YOUR_CLIENT_EMAIL"is the placeholder for the email associated with the service account."YOUR_CLIENT_ID"is the placeholder for the unique ID of the service account.
Here’s a sample GCS JSON file:
{
"bucket": "my-sample-bucket",
"type": "service_account",
"project_id": "ycrash-123456",
"private_key_id": "abc123def456ghi789jkl012mno345pqr678stu901",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMr0tbL1xF7uHhsD\n-----END PRIVATE KEY-----\n",
"client_email": "yc-service-account@my-project.iam.gserviceaccount.com",
"client_id": "11223344556677889900",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/yc-service-account%40my-project.iam.gserviceaccount.com"
}
2
3
4
5
6
7
8
9
10
11
12
13
In this sample:
"bucket"is the name of your GCS bucket."type"is always"service_account"for service accounts."project_id"is the ID of your Google Cloud project."private_key_id"and"private_key"are the ID and the actual private key associated with the service account."client_email"is the email associated with the service account."client_id"is the unique ID of the service account."auth_uri","token_uri","auth_provider_x509_cert_url", and"client_x509_cert_url"are standard URIs related to Google Cloud’s OAuth2 and service account management.
# 5. Restart the Application:
Restart the yCrash server application to apply the changes.
Note: All configuration files, including license.lic, *.xml, and *.json related to yCrash server settings, will continue to remain and be maintained in the uploadDir path.