Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dantetemplar committed Feb 25, 2024
1 parent f5d154b commit 56ac2d4
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 29 deletions.
125 changes: 116 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,133 @@
# InNoHassle Music room

[![GitHub Actions pre-commit](https://img.shields.io/github/actions/workflow/status/one-zero-eight/InNoHassle-MusicRoom/pre-commit.yaml?label=pre-commit)](https://github.com/one-zero-eight/InNoHassle-MusicRoom/actions)

[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=one-zero-eight_InNoHassle-MusicRoom&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=one-zero-eight_InNoHassle-MusicRoom)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=one-zero-eight_InNoHassle-MusicRoom&metric=bugs)](https://sonarcloud.io/summary/new_code?id=one-zero-eight_InNoHassle-MusicRoom)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=one-zero-eight_InNoHassle-MusicRoom&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=one-zero-eight_InNoHassle-MusicRoom)

1. Install [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer)
2. Install dependencies
```bash
poetry install --no-root
## Table of contents

Did you know that GitHub supports table of
contents [by default](https://github.blog/changelog/2021-04-13-table-of-contents-support-in-markdown-files/) 🤔

## About

This is the API for music room service in InNoHassle ecosystem.

### Features

- 🎵 Booking Music room
- 📅 Schedule of Music room
- 🔒 Roles and permissions

### Technologies

- [Python 3.11](https://www.python.org/downloads/release/python-3117/) & [Poetry](https://python-poetry.org/docs/)
- [FastAPI](https://fastapi.tiangolo.com/) & [Pydantic](https://docs.pydantic.dev/latest/)
- Database and ORM: [PostgreSQL](https://www.postgresql.org/), [SQLAlchemy](https://www.sqlalchemy.org/),
[Alembic](https://alembic.sqlalchemy.org/en/latest/)
- Formatting and linting: [Ruff](https://docs.astral.sh/ruff/), [Pre-commit](https://pre-commit.com/)
- Deployment: [Docker](https://www.docker.com/), [Docker Compose](https://docs.docker.com/compose/),
[GitHub Actions](https://github.com/features/actions)

## Development

### Getting started

1. Install [Python 3.11+](https://www.python.org/downloads/release/python-3117/)
2. Install [Poetry](https://python-poetry.org/docs/)
3. Install project dependencies with [Poetry](https://python-poetry.org/docs/cli/#options-2).
```bash
poetry install --no-root --with code-style
```
3. Setup settings
4. Set up [pre-commit](https://pre-commit.com/) hooks:

Run
```bash
poetry run pre-commit install --install-hooks -t pre-commit -t commit-msg
```
5. Set up project settings file (check [settings.schema.yaml](settings.schema.yaml) for more info).
```bash
cp settings.example.yaml settings.yaml
```
And edit settings.yaml
4. Run app
Edit `settings.yaml` according to your needs.
6. Set up a [PostgreSQL](https://www.postgresql.org/) database instance.
<details>
<summary>Using docker container</summary>

- Set up database settings for [docker-compose](https://docs.docker.com/compose/) container
in `.env` file:х
```bash
cp .env.example .env
```
- Run the database instance:
```bash
docker compose up -d db
```
- Make sure to set up the actual database connection in `settings.yaml`, for example:
```yaml
db_url: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
```

</details>
<details>
<summary>Using pgAdmin</summary>

- Connect to the PostgreSQL server using pgAdmin
- Set up a new database in the server: `Edit > New Object > New database`
- Use the database name in `settings.yaml` file, for example `innohassle-events`:
```yaml
db_url: postgresql+asyncpg://postgres:your_password@localhost:5432/innohassle-events
```
</details>

**Set up PyCharm integrations**

1. Ruff ([plugin](https://plugins.jetbrains.com/plugin/20574-ruff)).
It will lint and format your code.
Make sure to enable `Use ruff format` option in plugin settings.
2. Pydantic ([plugin](https://plugins.jetbrains.com/plugin/12861-pydantic)).
It will fix PyCharm issues with
type-hinting.
3. Conventional commits ([plugin](https://plugins.jetbrains.com/plugin/13389-conventional-commit)).
It will help you
to write [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).


### Run for development

1. Run the database if you have not done it yet
2. Upgrade the database schema using [alembic](https://alembic.sqlalchemy.org/en/latest/):
```bash
poetry run alembic upgrade head
```
3. Run the ASGI server
```bash
poetry run python -m src.api
```
Or
OR using uvicorn directly
```bash
poetry run uvicorn src.api.app:app --use-colors --proxy-headers --forwarded-allow-ips=*
```

Now the API is running on http://localhost:8000. Good job!

### Deployment

We use Docker with Docker Compose plugin to run the website on servers.

1. Copy the file with environment variables: `cp .env.example .env`
2. Change environment variables in the `.env` file
3. Copy the file with settings: `cp settings.example.yaml settings.yaml`
4. Change settings in the `settings.yaml` file according to your needs
(check [settings.schema.yaml](settings.schema.yaml) for more info)
5. Install Docker with Docker Compose
6. Build a Docker image: `docker compose build --pull`
7. Run the container: `docker compose up --detach`
8. Check the logs: `docker compose logs -f`

## Contributing

We are open to contributions of any kind.
You can help us with code, bugs, design, documentation, media, new ideas, etc.
If you are interested in contributing, please read our [contribution guide](https://github.com/one-zero-eight/.github/blob/main/CONTRIBUTING.md).
173 changes: 154 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ cryptography = "^41.0.4"
pillow = "^10.0.1"
pyyaml = "^6.0.1"
alembic = "^1.13.0"
ruff = "^0.1.8"
authlib = "^1.3.0"
python-docx = "^1.1.0"
icalendar = "^5.0.11"

[tool.poetry.group.code-style.]
optional = true
[tool.poetry.group.code-style.dependencies]
ruff = "^0.2.2"
pre-commit = "^3.6.2"

[tool.ruff]
line-length = 120
ignore = [
Expand Down

0 comments on commit 56ac2d4

Please sign in to comment.