# FastAPI Cookie Cutter Setup Instructions
## Prerequisites
- Docker
- Refer to [installation docs](https://docs.docker.com/engine/install/)
- Mac Install is easy via [:link:](https://docs.docker.com/docker-for-mac/install/)
- Ubuntu Instructions [:link:](https://docs.docker.com/engine/install/ubuntu/)
- Python 3
## Instructions
1. Create QA Project
```bash=
mkdir tqqaproject
cd tqqaproject
```
2. Create virtual Python env (make sure you're using Python 3) and activate it. A good cheat sheet to understand virtual envs is [Venv Cheatsheet :link:](https://aaronlelevier.github.io/virtualenv-cheatsheet/)
```bash=
/usr/bin/python3 -m venv venv
source venv/bin/activate
```
3. Pip install cookiecutter utility and run cookiecutter against repo
```bash=
pip install cookiecutter
cookiecutter https://github.com/tiangolo/full-stack-fastapi-postgresql
```
4. When prompted for configurable variables, use `tqqaproject` as the project_name and select the default for all other values

5. cd into the created project directory
```bash=
cd tqqaproject
```
6. Run all docker contains and stand up the app (this could take a while). The result will be a running application that you can reach at
```bash=
docker-compose up -d
```
7. Once the task is complete, you should be able to run:
```bash=
docker ps
```
and it should reveal the below screenshot

8. In your browser go to the app http://localhost/login
- The FE server is running @ port 80, so no need to add a port
9. Login. use the defaults that were given:
**u: admin@tqqaproject.com**
**p: changethis**

10. Once logged in, you should see this screen

11. View `README.md` in your directory for more information.
## FAQs
### ConnectionRefusedError
```
Traceback (most recent call last):
File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "site-packages/docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/requests/adapters.py", line 449, in send
File "site-packages/urllib3/connectionpool.py", line 727, in urlopen
File "site-packages/urllib3/util/retry.py", line 403, in increment
File "site-packages/urllib3/packages/six.py", line 734, in reraise
File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "site-packages/docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
```
- This is normally due to not having your docker engine running. Please makes sure you are running Docker. To quickly check, run:
```bash
docker ps
```
### "no space left on device"
```bash
ERROR: Service _____ failed to build : Error processing tar file(exit status 1)
```
- your Docker instance does not have enough space.
- Run the below to clear your docker space and re-run the docker-compose script above
```bash=
docker system prune
```
- If that doesn't work, make sure you allocated enough space to your VM or have enough space left on your machine.