Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/s3rgeym/url-shortener

Шаблон для разработки через Docker с возможностью отладки и автоматической перезагрузкой при изменении кода.
https://github.com/s3rgeym/url-shortener

asyncio docker docker-compose fastapi postgresql python vscode

Last synced: 1 day ago
JSON representation

Шаблон для разработки через Docker с возможностью отладки и автоматической перезагрузкой при изменении кода.

Awesome Lists containing this project

README

        

# URL Shortener

Real-world app example and template for development in Docker.

Development Stack: VSCode, Docker, Postgres, Pgadmin, Python, FastAPI, Asyncpg.

Launch compose:

```bash
docker compose up -d
```

Then `F5` > `Python: Remote Attach` for Debugging. The application will start only after the debugger. This is a development template.

Code changes will take effect immediately.

Create SHORT URL via Curl:

```bash
$ curl -d'url=https://www.youtube.com/watch?v=capY9GLjVk8' localhost:8000
http://localhost:8000/5ZTmyEZZW0~HPJnfptY9f
```

| URL | Service |
| --- | --- |
| | URL Shortener |
| | Documentation |
| | pgAdmin. Default credentials: `[email protected]:admin` |

![image](https://user-images.githubusercontent.com/12753171/278887688-8d1a7627-5349-44a8-b314-4fbae730cf59.png)
![image](https://user-images.githubusercontent.com/12753171/278843106-a24e55bd-5c6f-4b60-b1b9-d188e7562d3c.png)

Add new dependency:

```bash
# at host
poetry add whatever

# rebuild service
docker compose up -d --build --force-recreate --no-deps url_shortener

# or you can enter into container and add dependency
docker compose exec url_shortener sh
(inside container) poetry add whatever
```

Follow logs:

```bash
docker compose logs -f url_shortener
```

Stop:

```bash
docker compose down
```

Delete all data:

```bash
docker compose down -v --rmi all
```

Links:

*
*
*
*
*
*
*