# Development Setup ## Development Dependencies 1. Python `3.10.4` 2. Pip 3. Virtualenv 4. GNU make 5. PostgreSQL 6. SMTP server(instructions available for Docker setup) 7. (Optionally) Docker: used to spin up PostgreSQL instance ## Setup 1. Clone the project ```bash git clone https://gitea.hostea.org/Hostea/dashboard.git && cd dashboard ``` 2. Create `virtualenv` and activate environment ```bash virtualenv venv && source venv/bin/activate ``` 4. Setup local configuration: i) Initialize configuration file by copying `.env-sample` ```bash cp .env-sample .env ``` ii) Modify the contents of `.env`: ```bash export DATABSE_URL=postgres://postgres:password@localhost:5432/postgres export db=hostea-dashboard ``` iii) Load environment ```bash source .env ``` 3. Setup PostgreSQL _We are using Docker but you are welcome to bring your own PostgreSQL instance_ ```bash docker create --name $db \ -e POSTGRES_PASSWORD=password \ -p 5432:5432 \ postgres && \ docker start $db ``` 4. Setup SMTP server We are using the excellent development SMTP server [maildev](https://maildev.github.io/maildev/). ```bash docker create --name hostea-smtp \ -p 1080:1080 \ -p 10025:1025 \ maildev/maildev \ --incoming-user \ admin \ --incoming-pass password && \ docker start hostea-smtp ``` SMTP is available at port 10025 and the email web interface at port 1080 4. Install Dependencies ```bash make env ``` 5. Apply database migrations ```bash make migrate ``` 6. Create superuesr ```bash python manage.py createsuperuser ``` And provide information requested 7. Launch development server ```bash make ``` ## Troubleshooting ### Permission denied (publickey) in `make env` `make env` runs `./integration/ci.sh init` which bootstraps a local Gitea instance with some repositories for running tests. It also adds a deploy SSH key, with read/write access to those repositories. Please ensure the following: 1. The private key at [tests/fleet-deploy-key](../tests/fleet-deploy-key) has `600` permissions. If not: ```bash chmod 600 tests/fleet-deploy-key ``` 2. The Gitea instance listens at port 22, ensure it is listening on that port. This can be verified by checking for orphan Gitea instances and/or SSH daemons on that port.(TODO: listen SSH on different port)