Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{js,mjs,json}]
indent_size = 4

[*.{md,yml,yaml}]
indent_size = 2
trim_trailing_whitespace = false

[package.json]
indent_size = 2
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ the **[Zenko Forum](http://forum.zenko.io/)**.
> Questions opened as GitHub issues will systematically be closed, and moved to
> the [Zenko Forum](http://forum.zenko.io/).

--------------------------------------------------------------------------------
---

## Avoiding duplicates

Expand All @@ -21,7 +21,7 @@ any duplicates already open:
- if there is a duplicate, please do not open your issue, and add a comment
to the existing issue instead.

--------------------------------------------------------------------------------
---

## Bug report information

Expand Down Expand Up @@ -52,7 +52,7 @@ Describe the results you expected
- distribution/OS,
- optional: anything else you deem helpful to us.

--------------------------------------------------------------------------------
---

## Feature Request

Expand All @@ -78,10 +78,10 @@ Please provide use cases for changing the current behavior
### Additional information

- Is this request for your company? Y/N
- If Y: Company name:
- Are you using any Scality Enterprise Edition products (RING, Zenko EE)? Y/N
- If Y: Company name:
- Are you using any Scality Enterprise Edition products (RING, Zenko EE)? Y/N
- Are you willing to contribute this feature yourself?
- Position/Title:
- How did you hear about us?

--------------------------------------------------------------------------------
---
2 changes: 1 addition & 1 deletion .github/docker/vault-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"kmsAWS": {
"noAwsArn": true,
"providerName": "local",
"region": "us-east-1",
"region": "us-east-1",
"endpoint": "http://0:8080",
"ak": "456",
"sk": "123"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ jobs:
cache: pip
- name: Install python deps
run: pip install flake8
- name: Check code formatting
run: yarn run --silent check-format
- name: Lint Javascript
run: yarn run --silent lint -- --max-warnings 0
- name: Lint Markdown
run: yarn run --silent lint_md
- name: Lint python
run: flake8 $(git ls-files "*.py")
- name: Lint Yaml
Expand Down
32 changes: 32 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Build outputs
node_modules/
dist/
build/
coverage/

# Configuration files that should maintain their format
package-lock.json
yarn.lock
*.log

# Data directories
localData/
localMetadata/

# Test artifacts
artifacts/
**/junit/

# Binary files
*.png
*.jpg
*.jpeg
*.gif
*.ico
*.svg
*.pdf

# Generated or vendor files
*.min.js
*.min.css
*.map
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"singleQuote": true,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "avoid",
"printWidth": 120,
"endOfLine": "lf",
"bracketSameLine": false,
"singleAttributePerLine": false
}
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Contributing rules

Please follow the
[Contributing Guidelines](
https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).
[Contributing Guidelines](https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).

## Development Setup

For development setup, code style guidelines, and formatting instructions,
see the **Development** section in the [README.md](README.md#development).
16 changes: 8 additions & 8 deletions Healthchecks.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ response with HTTP code

- 200 OK

Server is up and running
Server is up and running

- 500 Internal Server error

Server is experiencing an Internal Error
Server is experiencing an Internal Error

- 400 Bad Request

Bad Request due to unsupported HTTP methods
Bad Request due to unsupported HTTP methods

- 403 Forbidden

Request is not allowed due to IP restriction
Request is not allowed due to IP restriction

## Stats

Expand Down Expand Up @@ -53,12 +53,12 @@ returned. This is accomplished by retrieving the 6 keys that represent the 6
five-second intervals. As Redis does not have a performant RANGE query, the
list of keys are built manually as follows

* Take current timestamp
- Take current timestamp

* Build each key by subtracting the interval from the timestamp (5 seconds)
- Build each key by subtracting the interval from the timestamp (5 seconds)

* Total keys for each metric (total requests, 500s etc.) is TTL / interval
30/5 = 6
- Total keys for each metric (total requests, 500s etc.) is TTL / interval
30/5 = 6

Note: When Redis is queried, results from non-existent keys are set to 0.

Expand Down
55 changes: 51 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ application on the go.
## Contributing

In order to contribute, please follow the
[Contributing Guidelines](
https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).
[Contributing Guidelines](https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).

## Installation

Expand Down Expand Up @@ -69,6 +68,54 @@ If you get an error regarding level-down bindings, try clearing your yarn cache:
yarn cache clean
```

## Development

### Code Style and Formatting

This project uses ESLint for code quality and Prettier for consistent code formatting.

#### Linting

Check code quality with ESLint:

```shell
yarn run lint
```

#### Formatting

Format all code with Prettier:

```shell
yarn run format
```

Check if code is properly formatted:

```shell
yarn run check-format
```

#### Pre-commit Guidelines

Before submitting a pull request, ensure that:

1. **Code is properly formatted**: Run `yarn run check-format` to verify
2. **Code passes linting**: Run `yarn run lint` to check for issues
3. **Tests pass**: Run `yarn test` for unit tests

The CI pipeline will automatically check formatting and linting, so make sure these pass locally first.

#### Code Style Rules

- **Quotes**: Use single quotes (`'`) instead of double quotes (`"`)
- **Indentation**: Use 4 spaces (no tabs)
- **Line Length**: Maximum 120 characters per line
- **Semicolons**: Always use semicolons
- **Trailing Commas**: Use trailing commas in ES5+ contexts

Prettier will automatically enforce most of these rules when you run `yarn run format`.

## Run it with a file backend

```shell
Expand All @@ -85,8 +132,8 @@ a secret key of verySecretKey1.
By default the metadata files will be saved in the
localMetadata directory and the data files will be saved
in the localData directory within the ./S3 directory on your
machine. These directories have been pre-created within the
repository. If you would like to save the data or metadata in
machine. These directories have been pre-created within the
repository. If you would like to save the data or metadata in
different locations of your choice, you must specify them with absolute paths.
So, when starting the server:

Expand Down
28 changes: 14 additions & 14 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
### Features tested

- Authentication
- Building signature
- Checking timestamp
- Canonicalization
- Error Handling
- Building signature
- Checking timestamp
- Canonicalization
- Error Handling

- Bucket Metadata API
- GET, PUT, DELETE Bucket Metadata
- GET, PUT, DELETE Bucket Metadata

- s3 API
- GET Service
- GET, PUT, DELETE, HEAD Object
- GET, PUT, DELETE, HEAD Bucket
- ACL's
- Bucket Policies
- Lifecycle
- Range requests
- Multi-part upload
- GET Service
- GET, PUT, DELETE, HEAD Object
- GET, PUT, DELETE, HEAD Bucket
- ACL's
- Bucket Policies
- Lifecycle
- Range requests
- Multi-part upload

- Routes
- GET, PUT, PUTRAW, DELETE, HEAD for objects and buckets
- GET, PUT, PUTRAW, DELETE, HEAD for objects and buckets

## Functional Tests

Expand Down
11 changes: 2 additions & 9 deletions bin/metrics_server.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
#!/usr/bin/env node
'use strict';

const {
startWSManagementClient,
startPushConnectionHealthCheckServer,
} = require('../lib/management/push');
const { startWSManagementClient, startPushConnectionHealthCheckServer } = require('../lib/management/push');

const logger = require('../lib/utilities/logger');

const {
PUSH_ENDPOINT: pushEndpoint,
INSTANCE_ID: instanceId,
MANAGEMENT_TOKEN: managementToken,
} = process.env;
const { PUSH_ENDPOINT: pushEndpoint, INSTANCE_ID: instanceId, MANAGEMENT_TOKEN: managementToken } = process.env;

if (!pushEndpoint) {
logger.error('missing push endpoint env var');
Expand Down
22 changes: 7 additions & 15 deletions bin/search_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ const http = require('http');
const https = require('https');
const logger = require('../lib/utilities/logger');

function _performSearch(host,
port,
bucketName,
query,
listVersions,
accessKey,
secretKey,
sessionToken,
verbose, ssl) {
function _performSearch(host, port, bucketName, query, listVersions, accessKey, secretKey, sessionToken, verbose, ssl) {
const escapedSearch = encodeURIComponent(query);
const options = {
host,
Expand Down Expand Up @@ -88,21 +80,21 @@ function searchBucket() {
.option('-h, --host <host>', 'Host of the server')
.option('-p, --port <port>', 'Port of the server')
.option('-s', '--ssl', 'Enable ssl')
.option('-l, --list-versions', 'List all versions of the objects that meet the search query, ' +
'otherwise only list the latest version')
.option(
'-l, --list-versions',
'List all versions of the objects that meet the search query, ' + 'otherwise only list the latest version'
)
.option('-v, --verbose')
.parse(process.argv);
const { host, port, accessKey, secretKey, sessionToken, bucket, query, listVersions, verbose, ssl } =
commander;
const { host, port, accessKey, secretKey, sessionToken, bucket, query, listVersions, verbose, ssl } = commander;

if (!host || !port || !accessKey || !secretKey || !bucket || !query) {
logger.error('missing parameter');
commander.outputHelp();
process.exit(1);
}

_performSearch(host, port, bucket, query, listVersions, accessKey, secretKey, sessionToken, verbose,
ssl);
_performSearch(host, port, bucket, query, listVersions, accessKey, secretKey, sessionToken, verbose, ssl);
}

searchBucket();
11 changes: 2 additions & 9 deletions bin/secure_channel_proxy.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
#!/usr/bin/env node
'use strict';

const {
startWSManagementClient,
startPushConnectionHealthCheckServer,
} = require('../lib/management/push');
const { startWSManagementClient, startPushConnectionHealthCheckServer } = require('../lib/management/push');

const logger = require('../lib/utilities/logger');

const {
PUSH_ENDPOINT: pushEndpoint,
INSTANCE_ID: instanceId,
MANAGEMENT_TOKEN: managementToken,
} = process.env;
const { PUSH_ENDPOINT: pushEndpoint, INSTANCE_ID: instanceId, MANAGEMENT_TOKEN: managementToken } = process.env;

if (!pushEndpoint) {
logger.error('missing push endpoint env var');
Expand Down
Loading
Loading