Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 00934-production-read…
Browse files Browse the repository at this point in the history
…iness-pass-custom-mirror-node-postgresql-credentials-and-server-address-along-with-disabling-stackgres-deployment
  • Loading branch information
instamenta committed Jan 9, 2025
2 parents eb7e99b + 5fe2f4e commit e7a1083
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/flow-gcs-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
export BUCKET_NAME=${{ steps.jobs.outputs.job_id }}-solo-streams
gcloud storage buckets create gs://${BUCKET_NAME} --project=${{ vars.GCP_S3_PROJECT_ID }}
echo "BUCKET_NAME=${BUCKET_NAME}" >> $GITHUB_ENV
export BACKUP_BUCKET_NAME=${{ steps.jobs.outputs.job_id }}-solo-backups
gcloud storage buckets create gs://${BACKUP_BUCKET_NAME} --project=${{ vars.GCP_S3_PROJECT_ID }}
echo "BACKUP_BUCKET_NAME=${BACKUP_BUCKET_NAME}" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
Expand Down Expand Up @@ -99,15 +103,18 @@ jobs:
- name: Compile Project
run: npm run build

- name: Run GCS Test Script for type ${{ matrix.channel }}
- name: Run GCS Test Script for type ${{ matrix.storageType }}
env:
GCS_ACCESS_KEY: ${{ secrets.GCP_S3_ACCESS_KEY }}
GCS_SECRET_KEY: ${{ secrets.GCP_S3_SECRET_KEY }}
BUCKET_NAME: ${{ env.BUCKET_NAME }}
BACKUP_BUCKET_NAME: ${{ env.BACKUP_BUCKET_NAME }}
STORAGE_TYPE: ${{ matrix.storageType }}
GCP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.GCP_SERVICE_ACCOUNT_TOKEN }}
run: |
.github/workflows/script/gcs_test.sh
- name: Delete Bucket after Test
run: |
gcloud storage rm --recursive gs://${BUCKET_NAME} --project=${{ vars.GCP_S3_PROJECT_ID }}
gcloud storage rm --recursive gs://${BACKUP_BUCKET_NAME} --project=${{ vars.GCP_S3_PROJECT_ID }}
28 changes: 27 additions & 1 deletion .github/workflows/script/gcs_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,25 @@ else
streamBucket=${BUCKET_NAME}
fi

if [ -z "${BACKUP_BUCKET_NAME}" ]; then
streamBackupBucket="solo-ci-backups"
else
streamBackupBucket=${BACKUP_BUCKET_NAME}
fi

if [ -z "${STORAGE_TYPE}" ]; then
storageType="gcs_and_minio"
else
storageType=${STORAGE_TYPE}
fi

if [ -z "${GCP_SERVICE_ACCOUNT_TOKEN}" ]; then
echo "GCP_SERVICE_ACCOUNT_TOKEN is not set. Exiting..."
exit 1
fi

echo "${GCP_SERVICE_ACCOUNT_TOKEN}" > gcp_service_account.json

echo "Using bucket name: ${streamBucket}"
echo "Test storage type: ${storageType}"

Expand All @@ -41,7 +54,9 @@ npm run solo-test -- node keys --gossip-keys --tls-keys -i node1
npm run solo-test -- network deploy -i node1 -n "${SOLO_NAMESPACE}" \
--storage-endpoint "https://storage.googleapis.com" \
--storage-access-key "${GCS_ACCESS_KEY}" --storage-secrets "${GCS_SECRET_KEY}" \
--storage-type "${storageType}" --storage-bucket "${streamBucket}"
--storage-type "${storageType}" --storage-bucket "${streamBucket}" \
--backup-bucket "${streamBackupBucket}" \
--google-credential gcp_service_account.json

npm run solo-test -- node setup -i node1 -n "${SOLO_NAMESPACE}"
npm run solo-test -- node start -i node1 -n "${SOLO_NAMESPACE}"
Expand All @@ -58,3 +73,14 @@ cd ..; create_test_account ; cd -
node examples/create-topic.js

npm run solo-test -- node stop -i node1 -n "${SOLO_NAMESPACE}"

# manually call script "backup.sh" from container backup-uploader since it only runs every 5 minutes
kubectl exec network-node1-0 -c backup-uploader -n solo-e2e -- /backup.sh > /dev/null 2>&1

# retrieve logs and check if it include the message type "error"
# example : {"level":"error","msg":"Updated modification time ......}
kubectl logs network-node1-0 -c backup-uploader -n solo-e2e > backup-uploader.log
if grep -q \""error\"" backup-uploader.log; then
echo "Backup uploader logs contain error message"
exit 1
fi
1 change: 0 additions & 1 deletion docs/content/User/SDK.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
First, please follow solo repository README to install solo and Docker Desktop.
You also need to install the Taskfile tool following the instructions [here](https://taskfile.dev/installation/).


Then we start with launching a local Solo network with the following commands:

```bash
Expand Down
24 changes: 24 additions & 0 deletions src/commands/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,28 @@ export class Flags {
prompt: undefined,
};

static readonly backupBucket: CommandFlag = {
constName: 'backupBucket',
name: 'backup-bucket',
definition: {
defaultValue: '',
describe: 'name of bucket for backing up state files',
type: 'string',
},
prompt: undefined,
};

static readonly googleCredential: CommandFlag = {
constName: 'googleCredential',
name: 'google-credential',
definition: {
defaultValue: '',
describe: 'path of google credential file in json format',
type: 'string',
},
prompt: undefined,
};

static readonly loadBalancerEnabled: CommandFlag = {
constName: 'loadBalancerEnabled',
name: 'load-balancer',
Expand Down Expand Up @@ -1780,6 +1802,8 @@ export class Flags {
Flags.storageSecrets,
Flags.storageEndpoint,
Flags.storageBucket,
Flags.backupBucket,
Flags.googleCredential,
Flags.tlsClusterIssuerType,
Flags.tlsPrivateKey,
Flags.tlsPublicKey,
Expand Down
29 changes: 29 additions & 0 deletions src/commands/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export interface NetworkDeployConfigClass {
storageSecrets: string;
storageEndpoint: string;
storageBucket: string;
backupBucket: string;
googleCredential: string;
}

export class NetworkCommand extends BaseCommand {
Expand Down Expand Up @@ -144,6 +146,8 @@ export class NetworkCommand extends BaseCommand {
flags.storageSecrets,
flags.storageEndpoint,
flags.storageBucket,
flags.backupBucket,
flags.googleCredential,
];
}

Expand Down Expand Up @@ -207,6 +211,23 @@ export class NetworkCommand extends BaseCommand {
`failed to create Kubernetes secret for storage credentials of type '${config.storageType}'`,
);
}
// generate backup uploader secret
if (config.googleCredential) {
const backupData = {};
const googleCredential = fs.readFileSync(config.googleCredential, 'utf8');
backupData['saJson'] = Base64.encode(googleCredential);
const isBackupSecretCreated = await this.k8.createSecret(
constants.BACKUP_SECRET_NAME,
namespace,
'Opaque',
backupData,
undefined,
true,
);
if (!isBackupSecretCreated) {
throw new SoloError(`failed to create Kubernetes secret for backup uploader of type '${config.storageType}'`);
}
}
} catch (e: Error | any) {
const errorMessage = 'failed to create Kubernetes storage secret ';
this.logger.error(errorMessage, e);
Expand All @@ -231,6 +252,8 @@ export class NetworkCommand extends BaseCommand {
storageSecrets: string;
storageEndpoint: string;
storageBucket: string;
backupBucket: string;
googleCredential: string;
loadBalancerEnabled: boolean;
}) {
let valuesArg = config.chartDirectory
Expand Down Expand Up @@ -279,6 +302,12 @@ export class NetworkCommand extends BaseCommand {
valuesArg += ` --set cloud.buckets.streamBucket=${config.storageBucket}`;
valuesArg += ` --set minio-server.tenant.buckets[0].name=${config.storageBucket}`;
}

if (config.backupBucket) {
valuesArg += ' --set defaults.sidecars.backupUploader.enabled=true';
valuesArg += ` --set defaults.sidecars.backupUploader.config.backupBucket=${config.backupBucket}`;
}

const profileName = this.configManager.getFlag<string>(flags.profileName) as string;
this.profileValuesFile = await this.profileManager.prepareValuesForSoloChart(profileName);
if (this.profileValuesFile) {
Expand Down
1 change: 1 addition & 0 deletions src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export const IGNORED_NODE_ACCOUNT_ID = '0.0.0';

export const UPLOADER_SECRET_NAME = 'uploader-mirror-secrets';
export const MINIO_SECRET_NAME = 'minio-secrets';
export const BACKUP_SECRET_NAME = 'backup-uploader-secrets';

export const enum StorageType {
MINIO_ONLY = 'minio_only',
Expand Down
1 change: 1 addition & 0 deletions test/e2e/commands/network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ describe('NetworkCommand', () => {
flags.storageAccessKey.constName,
flags.storageSecrets.constName,
flags.storageEndpoint.constName,
flags.googleCredential.constName,
]);
} catch (e) {
networkCmd.logger.showUserError(e);
Expand Down
1 change: 1 addition & 0 deletions test/test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export function e2eTestSuite(
flags.storageAccessKey.constName,
flags.storageSecrets.constName,
flags.storageEndpoint.constName,
flags.googleCredential.constName,
]);
}).timeout(Duration.ofMinutes(5).toMillis());

Expand Down
2 changes: 1 addition & 1 deletion version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

export const HELM_VERSION = 'v3.14.2';
export const SOLO_CHART_VERSION = '0.41.0';
export const SOLO_CHART_VERSION = '0.42.0';
export const HEDERA_PLATFORM_VERSION = 'v0.58.1';
export const MIRROR_NODE_VERSION = '0.118.1';
export const HEDERA_EXPLORER_VERSION = '0.2.1';
Expand Down

0 comments on commit e7a1083

Please sign in to comment.