From b6528b97c727fe6a37d9390194fd85d41b199186 Mon Sep 17 00:00:00 2001 From: jiisanda Date: Sun, 31 Dec 2023 17:43:07 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=99=86=E2=80=8D=E2=99=82=EF=B8=8F=20READM?= =?UTF-8?q?E.md=20Setup=20locally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++- app/docs/commands/sample_env.txt | 2 +- app/docs/setup.md | 74 ++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 app/docs/setup.md diff --git a/README.md b/README.md index 3864175..247a3f7 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ DocFlow is a powerful Document Management API designed to streamline document ha ## 📖 API Documentation and Image + Explore the [API Documentation](https://documenter.getpostman.com/view/20984268/2s9YRGxUcp) for detailed information on how to use DocFlow's features. Download docker image from [docker-hub](https://hub.docker.com/r/jiisanda/docflow). @@ -37,6 +38,10 @@ Or just run docker pull jiisanda/docflow:1 ``` +## 🔸 Setup Docflow + +Follow the steps outlined in the [setup.md](app/docs/setup.md) file + ## 🧩 Implementation Detail @@ -88,4 +93,4 @@ For detailed instructions, visit the [Document Preview Documentation](https://gi For any questions or support, please [contact](mailto:harshjaiswal2307@gmail.com). -Enjoy using DocFlow to manage your documents seamlessly! +Test DocFlow to manage documents seamlessly! diff --git a/app/docs/commands/sample_env.txt b/app/docs/commands/sample_env.txt index 4017f20..2108c5c 100644 --- a/app/docs/commands/sample_env.txt +++ b/app/docs/commands/sample_env.txt @@ -13,7 +13,7 @@ S3_BUCKET= S3_TEST_BUCKET= # User Env -ACCESS_TOKEN_EXPIRE_MIN=30 +ACCESS_TOKEN_EXPIRE_MIN=300 REFRESH_TOKEN_EXPIRE_MIN=30 ALGORITHM= JWT_SECRET_KEY= diff --git a/app/docs/setup.md b/app/docs/setup.md new file mode 100644 index 0000000..4245dac --- /dev/null +++ b/app/docs/setup.md @@ -0,0 +1,74 @@ +# 🚀 Setting up Docflow Locally + +Just a 3-step process to get Docflow up and running on your local machine! 🌐 + +### 1️⃣ Clone the repository + +```bash +git clone https://www.github.com/jiisanda/docflow.git +``` + +### 2️⃣ Configure Your Environment + +Start by creating your environment file using the provided [sample_env.txt](commands/sample_env.txt). This file contains all the necessary +environment variables for Docflow. Save it inside the app/ directory. + +#### PostgreSQL Setup + +Set up your PostgreSQL environment variables: + +- `DATABASE_HOSTNAME`: By default, set to `postgres`. +- `POSTGRES_USER`, `POSTGRES_PASSWORD` and `POSTGRES_PORT`: Enter your PostgreSQL username, password, and port +(default is `5432`). +- `POSTGRES_DB` and `POSTGRES_DB_TESTS`: Specify your database names (`POSTGRES_DB_TESTS` can be left blank). + +#### AWS Setup +For AWS credentials (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`), follow these steps: + +>1. Sign in to the [AWS Management Console]() using your AWS account's root user credentials. +>2. Navigate to Security Credentials and create an access key. +>3. Copy the access key ID and secret key securely. +>4. For S3 bucket setup, refer to creating a [bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html). +> +> Source: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user_manage_add-key.html + +#### User Environment + +Keep `ACCESS_TOKEN_EXPIRE_MIN` and `REFRESH_TOKEN_EXPIRE_MIN` as default. Update the `ALGORITHM` of your choice (e.g., `HS256` or `RS256`). + +Generate `JWT_SECRET_KEY` and `JWT_REFRESH_SECRET_KEY` using Python: +```bash +docflow$ python +>> import secrets +>> secrets.token_urlsafe(length=32) +'some-random-secret-of-length-32' +>> secret.token_hex(length=32) +'some-random-secret-of-length-32' +``` +#### Email Service + +This section explains how to set up the email service using Gmail. Configure the following variables: + +`SMTP_SERVER`: `smtp.gmail.com` +`SMTP_PORT`: `587` +`EMAIL`: `Your email address used to create the app`. +`APP_PASSWORD`: `Generate an app password from your Google Account`. +Before starting, ensure you have enabled "Two-Factor Authentication" and "Less secure app access" for your Gmail account. + +>For a deeper understanding of environment variables in Python, check out this article: +>[@dev.to/jiisanda](https://dev.to/jiisanda/how-does-python-dotenv-simplify-configuration-management-3ne6) + + +### 3️⃣ Run with Docker-Compose + +Ensure Docker is installed, then run: + +```commandline +docker-compose up --build +``` + +That's it! Docflow is now running on localhost:8000. + +## ⏭️ Next Step +To test it, use Postman following the steps in +[postman.md](features/postman.md). \ No newline at end of file