Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.x #110

Merged
merged 37 commits into from
May 15, 2024
Merged

Version 2.x #110

merged 37 commits into from
May 15, 2024

Conversation

loookashow
Copy link
Contributor

@loookashow loookashow commented Apr 23, 2024

Overview:

  • Added support for uploading files from AWS S3 buckets.
  • Results of each upload attempt are recorded in a local SQLite database. This prevents duplicate uploads of the same file if it fails to upload on the first attempt.
  • Upon completion of the upload, information about the results is written to a CSV file in the /logs directory.
  • Added functionality to save credentials in a .env file, as well as a drop command to clear all saved data: records in the database, logs from the /logs directory, and all accesses from the .env file.
  • Added new commands to the CLI.

More details:

  • Added a database manager class db_manager.py in the /db directory. Upon first initialization, a SQLite database is created there to store data.
  • The main control class Fetcher, which contains all the logic for uploading, interacting with the database, visualizing upload progress, and launching asynchronous loops, has been moved to uploader/fetcher.py.
  • Implemented logic for interacting with S3 buckets in uploader/s3_client.py using boto3. Before starting the upload, permissions for "GetObject" and "ListObjects" are checked, which are necessary for generating temporary signed URLs.
  • Added a utility in utils.py that saves the results in CSV files in the /logs directory.
  • Implemented new command-line management logic in cli.py, considering all the new features.

Known Issues:

Occasionally, a notification like the following appears:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x10607ce20>

I haven't looked into what can be done about it yet, but it may require some code rewriting in uploader/utils.py to make it more up-to-date. However, this may require dropping support for Python versions prior to 3.8 (although the README already states that versions 3.8+ are supported).

Open Questions:

TBD: Should we keep the script in the library that collects links from Filestack? At the very least, it needs to be tested to see if it works or not. I haven't tested it yet.

Summary by CodeRabbit

  • New Features

    • Introduced a new database management system for tracking file uploads.
    • Enhanced command-line interface with new commands for initialization, URL migration, S3 migration, and data cleanup.
    • Added capabilities to fetch files from URLs and S3 buckets and manage upload processes.
    • New utility function to save results to CSV format.
  • Documentation

    • Updated README with detailed instructions for setting up and using the Migro tool with AWS S3 and other services.
  • Refactor

    • Updated the .gitignore to exclude database files and logs.
    • Improved handling of environment variables and command-line options.
  • Bug Fixes

    • Adjusted error handling and consistency in the uploader's utility functions.
  • Chores

    • Added new dependencies to support AWS S3 operations and environment variable management.

Copy link
Contributor

coderabbitai bot commented Apr 23, 2024

Walkthrough

The updates have significantly improved the Migro tool's functionality for migrating files to Uploadcare from various sources like AWS S3. These enhancements include the introduction of a database module for tracking upload attempts, expanded CLI functionalities with new commands, and the integration of support libraries like boto3 and python-dotenv for smoother operations and settings management.

Changes

Files Change Summary
.gitignore Excluded db/*.db files and logs directory.
README.rst Revamped with detailed Migro tool usage and setup instructions.
db/__init__.py, db/db_manager.py Introduced database module and DBManager class for upload tracking.
migro/__init__.py, migro/cli.py Updated package version; added new CLI functionalities and commands.
migro/settings.py, migro/uploader/fetcher.py, .../s3_client.py, .../utils.py Added S3 configurations, enhanced file fetching, and utility adjustments.
requirements.txt, setup.py Included new dependencies boto3, python-dotenv.
tests/test_uploader.py Reordered import statements.

🐰✨
Oh hooray! Oh hooray!
For the code that we've spun,
From dawn till the day,
Our tasks, they are done.
Leaping through fields of binary,
In bytes and bits, we trust,
Our digital warren grows merry!
🌟🐇💻


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 59d1351 and 67f487d.
Files selected for processing (1)
  • README.rst (2 hunks)
Additional comments not posted (2)
README.rst (2)

1-19: LGTM! The introductory section with the logo is well-formatted and adapts to light and dark themes.


22-51: LGTM! The tool description and installation instructions are clear and concise.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@loookashow loookashow requested a review from alxgsv April 23, 2024 18:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Out of diff range and nitpick comments (2)
migro/utils.py (1)

6-17: The function save_result_to_csv correctly handles the creation of directories and files for logging. Consider adding error handling for file operations to manage exceptions that may arise during file writing.

migro/uploader/process_loop.py (1)

32-40: The signal handling setup in process_loop.py correctly handles UNIX signals. Consider adding a comment to clarify that Windows does not support these signals, as indicated by the NotImplementedError handling.

migro/uploader/fetcher.py Outdated Show resolved Hide resolved
migro/uploader/fetcher.py Show resolved Hide resolved
migro/uploader/fetcher.py Show resolved Hide resolved
migro/uploader/fetcher.py Outdated Show resolved Hide resolved
migro/uploader/fetcher.py Outdated Show resolved Hide resolved
migro/uploader/fetcher.py Show resolved Hide resolved
db/db_manager.py Outdated Show resolved Hide resolved
migro/cli.py Outdated Show resolved Hide resolved
@alxgsv
Copy link

alxgsv commented Apr 24, 2024

@loookashow how do you like the review?

loookashow and others added 4 commits April 24, 2024 10:32
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@loookashow
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Comment on lines +91 to +105
Migrating files
---------------

Migro supports migration from the following sources:

- AWS S3: The tool scans the bucket, generates temporary signed URLs, and migrates all files.
- File with URLs: The tool reads a file containing URLs and migrates all files listed.

Each migration source requires the following arguments:

``<PUBLIC_KEY>`` — your Uploadcare project `public key`_.

``[<SECRET_KEY>]`` — your Uploadcare project secret key.
This is optional and required only if the signed uploads feature is enabled in your project.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the requirements for secret keys.

The documentation should clearly state under what conditions the secret key is necessary. This will help users understand when they need to provide this additional piece of information.

README.rst Outdated
Comment on lines 128 to 186
How it works:
1. Migro verifies the credentials provided and checks if the bucket policy is correct.
2. The tool then scans the bucket and generates temporary signed URLs for all files.
3. Migro proceeds to upload all files to Uploadcare.


Set policy for a bucket
~~~~~~~~~~~~~~~~~~~~~~~

To ensure proper functionality, set the following minimal permissions for your AWS S3 bucket policy:

.. code-block::

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::<YOUR BUCKET NAME>",
"arn:aws:s3:::<YOUR BUCKET NAME>/*"
]
}
]
}

Remember to replace <YOUR BUCKET NAME> with your actual bucket name.

To initiate the migration, execute the following command:

.. code-block:: console

--output_file FILE Path to a Migro output file. [default:
migro_result.txt]
$ migro s3 <PUBLIC_KEY> [<SECRET_KEY>] [<OPTIONS>]

--upload_base TEXT Base URL for uploads. [default:
https://upload.uploadcare.com/]
For example:

--from_url_timeout FLOAT Number of seconds to wait till the file will be
processed by `from_url` upload. [default: 30]
.. code-block:: console

$ migro s3 <PUBLIC_KEY> --s3_bucket_name <BUCKET_NAME> --s3_access_key_id <ACCESS_KEY_ID> --s3_secret_access_key <SECRET_ACCESS_KEY> --s3_region <REGION>


Options:

.. code-block::


-h, --help Show this help and quit.

--s3_bucket_name STRING Name of the AWS S3 bucket to migrate files from.

--s3_access_key_id STRING AWS Access Key ID for accessing the S3 bucket.

--s3_secret_access_key STRING AWS Secret Access Key for accessing the S3 bucket.

--max_uploads INTEGER Maximum number of upload requests running in
'parallel'. [default: 20]
--s3_region STRING AWS region where the S3 bucket is located.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review and update the AWS S3 bucket policy example.

Ensure that the bucket policy example provided is up-to-date and includes all necessary permissions for the operations that Migro performs. This is crucial for preventing access issues during migration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

db/db_manager.py Show resolved Hide resolved
db/db_manager.py Outdated Show resolved Hide resolved
db/db_manager.py Outdated Show resolved Hide resolved
db/db_manager.py Outdated Show resolved Hide resolved
migro/cli.py Outdated Show resolved Hide resolved
migro/uploader/fetcher.py Outdated Show resolved Hide resolved
migro/uploader/fetcher.py Outdated Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
Comment on lines +38 to +41
SOURCES = {
'URLS': 'urls',
'S3': 's3'
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like these should be subclasses
S3Fetcher, URLFetcher

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

migro/cli.py Outdated Show resolved Hide resolved
migro/cli.py Outdated
Comment on lines 48 to 63
def update_dotenv(key, value, env_file_path):
with open(env_file_path, 'r') as file:
lines = file.readlines()

if sys.version_info < (3, 7):
await asyncio.gather(*tasks)
else:
await asyncio.gather(*tasks, return_exceptions=True)
key_exists = False
for i, line in enumerate(lines):
if line.startswith(f'{key}='):
lines[i] = f'{key}={value}\n'
key_exists = True
break

running_loop = asyncio.get_running_loop() if sys.version_info >= (3, 7) else asyncio.get_event_loop()
running_loop.stop()
if not key_exists:
lines.append(f'{key}={value}\n')

with open(env_file_path, 'w') as file:
file.writelines(lines)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling for file operations in update_dotenv to prevent crashes due to I/O issues.

+ try:
  with open(env_file_path, 'r') as file:
      lines = file.readlines()
  key_exists = False
  for i, line in enumerate(lines):
      if line.startswith(f'{key}='):
          lines[i] = f'{key}={value}\n'
          key_exists = True
          break
  if not key_exists:
      lines.append(f'{key}={value}\n')
  with open(env_file_path, 'w') as file:
      file.writelines(lines)
+ except IOError as e:
+     click.secho(f"Failed to update .env file: {str(e)}", fg='red')

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
def update_dotenv(key, value, env_file_path):
with open(env_file_path, 'r') as file:
lines = file.readlines()
if sys.version_info < (3, 7):
await asyncio.gather(*tasks)
else:
await asyncio.gather(*tasks, return_exceptions=True)
key_exists = False
for i, line in enumerate(lines):
if line.startswith(f'{key}='):
lines[i] = f'{key}={value}\n'
key_exists = True
break
running_loop = asyncio.get_running_loop() if sys.version_info >= (3, 7) else asyncio.get_event_loop()
running_loop.stop()
if not key_exists:
lines.append(f'{key}={value}\n')
with open(env_file_path, 'w') as file:
file.writelines(lines)
def update_dotenv(key, value, env_file_path):
try:
with open(env_file_path, 'r') as file:
lines = file.readlines()
key_exists = False
for i, line in enumerate(lines):
if line.startswith(f'{key}='):
lines[i] = f'{key}={value}\n'
key_exists = True
break
if not key_exists:
lines.append(f'{key}={value}\n')
with open(env_file_path, 'w') as file:
file.writelines(lines)
except IOError as e:
click.secho(f"Failed to update .env file: {str(e)}", fg='red')

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Out of diff range and nitpick comments (1)
tests/test_uploader.py (1)

Line range hint 26-38: Consider using a fixture or context manager to temporarily set settings.PUBLIC_KEY during the test to avoid side effects in other tests.

migro/cli.py Show resolved Hide resolved
loookashow and others added 5 commits April 26, 2024 16:26
Co-authored-by: Dmitry Mukhin <dm+github@uploadcare.com>
Co-authored-by: Dmitry Mukhin <dm+github@uploadcare.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Co-authored-by: Dmitry Mukhin <dm+github@uploadcare.com>
README.rst Outdated Show resolved Hide resolved
loookashow and others added 2 commits April 29, 2024 11:14
Co-authored-by: Dmitry Mukhin <dm+github@uploadcare.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Out of diff range and nitpick comments (1)
README.rst (1)

34-44: The migration process is described succinctly. Consider enhancing this section with a diagram or flowchart for better visual understanding, especially for users new to such operations.

Comment on lines +51 to +72
In order to install ``migro``, run:

.. code-block:: console

$ pip install uploadcare-migro


Usage
-----
Get started
-----------

To begin using Migro, you must have your Uploadcare project `public key`_.

Optionally, you can store the public key and other necessary credentials in environment variables.
This approach is beneficial if you must migrate many files, allowing you to perform multiple migrations efficiently.

.. code-block:: console

$ migro <PUBLIC_KEY> <INPUT_FILE>
$ migro init <OPTIONS>

Where:
After running the initialization command, your credentials will be saved in a local ``.env``
file, allowing you to use Migro without specifying them in the command line each time.
Once the ``.env`` file is created, you can edit it manually if needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installation and initialization instructions are clear. However, it's crucial to emphasize the security best practices for handling the .env file. Consider adding a warning about securing this file against unauthorized access.

Comment on lines +281 to +293
Once the migration is complete, execute the ``migro drop`` command to
remove the `.env` file containing credentials, clear the local database, and the logs folder.

.. code-block:: console

$ migro drop


Note for Windows users
----------------------

Currently there is an issue with program termination by CTRL+C on Windows, so
program can no be terminated correctly by this way.
Currently, there is an issue with terminating the program using CTRL+C on Windows.
As a result, the program cannot be terminated correctly using this method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address the termination issue on Windows by providing a workaround or potential fix. This will improve the user experience for Windows users.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Comment on lines +11 to +15
from functools import wraps
from pathlib import Path

import click
from dotenv import dotenv_values, find_dotenv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move module level imports to the top of the file.

+ import os
+ import sys
+ from pathlib import Path
+ from dotenv import dotenv_values, find_dotenv
+ import click

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
from functools import wraps
from pathlib import Path
import click
from dotenv import dotenv_values, find_dotenv
import os
import sys
from pathlib import Path
from dotenv import dotenv_values, find_dotenv
import click
from functools import wraps

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Comment on lines +49 to +64
def update_dotenv(key, value, env_file_path):
with open(env_file_path, 'r') as file:
lines = file.readlines()

[task.cancel() for task in tasks]
key_exists = False
for i, line in enumerate(lines):
if line.startswith(f'{key}='):
lines[i] = f'{key}={value}\n'
key_exists = True
break

if sys.version_info < (3, 7):
await asyncio.gather(*tasks)
else:
await asyncio.gather(*tasks, return_exceptions=True)
if not key_exists:
lines.append(f'{key}={value}\n')

running_loop = asyncio.get_running_loop() if sys.version_info >= (3, 7) else asyncio.get_event_loop()
running_loop.stop()
with open(env_file_path, 'w') as file:
file.writelines(lines)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling for file operations in update_dotenv to prevent crashes due to I/O issues.

+ try:
  with open(env_file_path, 'r') as file:
      lines = file.readlines()
  key_exists = False
  for i, line in enumerate(lines):
      if line.startswith(f'{key}='):
          lines[i] = f'{key}={value}\n'
          key_exists = True
          break
  if not key_exists:
      lines.append(f'{key}={value}\n')
  with open(env_file_path, 'w') as file:
      file.writelines(lines)
+ except IOError as e:
+     click.secho(f"Failed to update .env file: {str(e)}", fg='red')

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
def update_dotenv(key, value, env_file_path):
with open(env_file_path, 'r') as file:
lines = file.readlines()
[task.cancel() for task in tasks]
key_exists = False
for i, line in enumerate(lines):
if line.startswith(f'{key}='):
lines[i] = f'{key}={value}\n'
key_exists = True
break
if sys.version_info < (3, 7):
await asyncio.gather(*tasks)
else:
await asyncio.gather(*tasks, return_exceptions=True)
if not key_exists:
lines.append(f'{key}={value}\n')
running_loop = asyncio.get_running_loop() if sys.version_info >= (3, 7) else asyncio.get_event_loop()
running_loop.stop()
with open(env_file_path, 'w') as file:
file.writelines(lines)
def update_dotenv(key, value, env_file_path):
try:
with open(env_file_path, 'r') as file:
lines = file.readlines()
key_exists = False
for i, line in enumerate(lines):
if line.startswith(f'{key}='):
lines[i] = f'{key}={value}\n'
key_exists = True
break
if not key_exists:
lines.append(f'{key}={value}\n')
with open(env_file_path, 'w') as file:
file.writelines(lines)
except IOError as e:
click.secho(f"Failed to update .env file: {str(e)}", fg='red')

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Comment on lines +61 to +72
To begin using Migro, you must have your Uploadcare project `public key`_.

Optionally, you can store the public key and other necessary credentials in environment variables.
This approach is beneficial if you must migrate many files, allowing you to perform multiple migrations efficiently.

.. code-block:: console

$ migro <PUBLIC_KEY> <INPUT_FILE>
$ migro init <OPTIONS>

Where:
After running the initialization command, your credentials will be saved in a local ``.env``
file, allowing you to use Migro without specifying them in the command line each time.
Once the ``.env`` file is created, you can edit it manually if needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhance the security advice for credential storage.

Consider adding a warning about securing the .env file against unauthorized access, especially since it contains sensitive information.

Comment on lines +34 to +44
How migration works
-------------------

Migro does not directly download any files. Instead, it utilizes
the `Uploading API`_, specifically the ``From URL`` method_.
The migration process is straightforward: you either provide a list of file
URLs or set your AWS S3 credentials, and those files are uploaded to your Uploadcare project.

Upon completion, you will receive a listing of all uploaded files.
You will also receive details on the status of each processed file and any errors that may have occurred.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the migration process details.

Consider adding more details or a step-by-step breakdown of the migration process to enhance clarity for users who might be new to such operations.

Comment on lines +128 to +160
How it works:
1. Migro verifies the credentials provided and checks if the bucket policy is correct.
2. The tool then scans the bucket and generates temporary signed URLs for all files.
3. Migro proceeds to upload all files to Uploadcare.


Set policy for a bucket
~~~~~~~~~~~~~~~~~~~~~~~

To ensure proper functionality, set the following minimal permissions for your AWS S3 bucket policy:

.. code-block::

{
"Version": "2012-10-17",
"Statement": [
{
"Principal": "*",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::<YOUR BUCKET NAME>",
"arn:aws:s3:::<YOUR BUCKET NAME>/*"
]
}
]
}

Remember to replace <YOUR BUCKET NAME> with your actual bucket name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review and update the AWS S3 bucket policy example.

Ensure that the bucket policy example provided is up-to-date and includes all necessary permissions for the operations that Migro performs. This is crucial for preventing access issues during migration.

Comment on lines +282 to +288
Once the migration is complete, execute the ``migro drop`` command to
remove the `.env` file containing credentials, clear the local database, and the logs folder.

.. code-block:: console

$ migro drop

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhance the post-migration cleanup instructions.

Consider providing specific commands or steps for securely removing the .env file, clearing the local database, and the logs folder to ensure that all sensitive data is properly handled.

Comment on lines +293 to +294
Currently, there is an issue with terminating the program using CTRL+C on Windows.
As a result, the program cannot be terminated correctly using this method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address the termination issue on Windows by providing a workaround or potential fix.

This will improve the user experience for Windows users. Consider suggesting alternative methods for terminating the program or addressing the underlying issue.

@@ -35,11 +35,11 @@ def common_options(func):
@wraps(func)
@click.option('--upload_base_url', help="Base URL for uploads.", type=str, default=env.get('UPLOAD_BASE'))
@click.option('--upload_timeout',
help="Number of seconds to wait till the file will be processed by `from_url` upload.", type=int,
help="Number of seconds to wait till the file will be processed by `from_url` upload.", type=float,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here and below,
why float?

@dmitry-mukhin
Copy link
Member

there are some outstanding questions that we should address at some point @loookashow

@dmitry-mukhin dmitry-mukhin merged commit 695dd0d into master May 15, 2024
3 checks passed
@dmitry-mukhin dmitry-mukhin deleted the version-2.x branch May 15, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants