relivator-docker-backend

🔽 Relivator: The Docker Edition (Backend) | Frontend: https://github.com/blefnk/relivator-docker-frontend | Stack: Docker, Python, FastAPI, fly.io flyctl, frontend health check and more 😊

MIT License

Stars
3

Relivator: The Docker Edition (Backend)

Frontend's Repo: https://github.com/blefnk/relivator-docker-frontend

Getting Started

Prerequisites

  • IDE (VSCode recommended)
  • Python (tested with 3.11.8 version)
  • Docker and Docker Compose (for containerized development and deployment)
  • For Windows only: Powershell 7

Installation

The paths below are an example, you can use any you like.

1. Clone the repository:

mkdir C:\B\S\reliverse && cd C:\B\S\reliverse # Windows
mkdir ~/Desktop/B/S/reliverse && cd ~/Desktop/B/S/reliverse # macOS/Linux
git clone https://github.com/blefnk/relivator-docker-backend.git
cd relivator-docker-backend

2. Create and activate a virtual environment:

Windows:

python -m venv C:\B\A\python\venv\main

macOS/Linux:

python -m venv ~/Desktop/B/A/python/venv/main

3. Configure workspace:

Then open project in VSCode > Ctrl+Shift+P > Terminal: Create New Terminal

Windows:

# Ctrl+Shift+P > Python: Select Interpreter > Enter interpreter path
# Find... > And choose python.exe in C:\B\A\python\venv\main\Scripts
C:\B\A\python\venv\main\Scripts\activate.ps1 # Or use .bat when CMD

macOS/Linux:

source ~/Desktop/B/A/python/venv/main/bin/activate

4. Install dependencies:

The project already has many pre-selected good packages, so you can easily get started, or remove unused packages whenever you want.

So, to install the packages listed in requirements.txt just run:

cd backend && pip install -r requirements.txt

Development

Start the development server:

uvicorn main:app --reload
# http://localhost:10000
# http://localhost:10000/items/5?q=example

A tip!

Remember to work on the activate virtual environment after each new terminal with:

C:\B\A\python\venv\main\Scripts\activate.ps1 # .bat cmd, Windows
source ~/Desktop/B/A/python/venv/main/bin/activate # macOS/Linux

So you will see something like that:

  • Windows (main) PS C:\B\S\reliverse\relivator-docker-backend\backend >
  • macOS/Linux (main) user@machine:~/Desktop/B/S/reliverse/relivator-docker-backend/backend$

Deployment and dockerizing

Instructions for building and running the project using Docker are forthcoming.

Getting Things Ready:

  1. Install Docker Desktop and flyctl.
  2. Create an account with fly auth signup or login with fly auth login.
  3. Run fly launch from inside your project source directory to create, configure, and (for most apps) deploy a new application.
  4. If prompted, run fly deploy to deploy your new app (or to redeploy after changes!).

Contributing

Thanks for considering contributions to Reliverse, means to Relivator Universe, means to the one of main universe of Bleverse (Blefonix Multiverse)!

  1. Follow the installation steps above, including deployment steps.
  2. Update requirements.txt if needed: pip freeze > requirements.txt.
  3. Make your changes. Ensure you have successful build with flyctl deploy.
  4. Commit the changes to your repo fork. Submit a PR to relivator-docker-backend.
  5. [optional] Visit and sign up on bleverse.com to collect your reward as a thank you. (You can win even Blefcoins or even Blefonix Stone!)