feat: Add awesome devcontainer intro and better readme
This commit is contained in:
parent
70fc374d0d
commit
47b682c509
|
@ -1,4 +1,4 @@
|
||||||
version: "3"
|
version: "3.4"
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -20,4 +20,5 @@ services:
|
||||||
# - SPEJSTORE_MEDIA_ROOT=
|
# - SPEJSTORE_MEDIA_ROOT=
|
||||||
# - SPEJSTORE_REQUIRE_AUTH=true
|
# - SPEJSTORE_REQUIRE_AUTH=true
|
||||||
- SPEJSTORE_OAUTH_REDIRECT_IS_HTTPS=false
|
- SPEJSTORE_OAUTH_REDIRECT_IS_HTTPS=false
|
||||||
|
- SPEJSTORE_SPEJSTORE_FILE_STORAGE_TYPE="filesystem"
|
||||||
# - SPEJSTORE_PROXY_TRUSTED_IPS=172.21.37.1
|
# - SPEJSTORE_PROXY_TRUSTED_IPS=172.21.37.1
|
||||||
|
|
|
@ -20,3 +20,4 @@ log
|
||||||
.Dockerfile
|
.Dockerfile
|
||||||
.env
|
.env
|
||||||
.devcontainer
|
.devcontainer
|
||||||
|
readme
|
||||||
|
|
49
README.md
49
README.md
|
@ -1,33 +1,46 @@
|
||||||
# spejstore
|
# spejstore (AKA inventory)
|
||||||
|
|
||||||
|
The general HSWAW (and other polish hackerspaces) inventory system.
|
||||||
|
|
||||||
Because there is not enough general inventory software invented here yet.
|
Because there is not enough general inventory software invented here yet.
|
||||||
Please use Python3, for the love of `$deity`...
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Quick start
|
### Quick start (VSCode)
|
||||||
|
|
||||||
1. Run:
|
1. Copy `.env.example` as `.env`
|
||||||
```sh
|
2. Have `docker compose` 2.0. You can identify it by having `docker compose` command instead of `docker-compose`.
|
||||||
ln -s docker-compose.dev-override.yml docker-compose.override.yml
|
3. Customize your `.env` for your specific usecase.
|
||||||
docker-compose up --build
|
|
||||||
```
|
|
||||||
2. Run `docker-compose run --rm web python manage.py createsuperuser` -- now you can dev authenticate w/o SSO
|
|
||||||
|
|
||||||
### Build & run
|
#### VSCode
|
||||||
|
|
||||||
```sh
|
0. Setup environment variables
|
||||||
docker-compose up --build
|
1. Get VSCode from [here](https://code.visualstudio.com/download), *CAN NOT* be VSCodium, as the extension is a microsoft binary which does not work with VSCodium.
|
||||||
|
2. Install [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension
|
||||||
|
3. Clone the repository and open it with VSCode.
|
||||||
|
4. You should get a toast like this when re-opening directory with the cloned repository. ![Toast example](readme/toast-example.png 'Toast example')
|
||||||
|
1. If you don't get a toast, then use (CMD|Ctrl)+Shift+P to open actions menu and choose option **Rebuild Without Cache and Reopen in Container**. ![Command example](readme/command-example.png 'Command example')
|
||||||
|
5. Reopen the directory in container either via command or popup button.
|
||||||
|
6. Wait for the application and container to properly build.
|
||||||
|
1. Devcontainer's VSCode instance will be automatically configured with extensions to help your development process.
|
||||||
|
2. You might get a Toast telling you to re-open the directory due to Black not working properly. Do so for proper autoformatting support.
|
||||||
|
7. `manage.py migrate` will be run automatically after container creation, to make sure you have the latest migrations done on the development database without any need for interaction.
|
||||||
|
8. Run debug session with either command of "Start Debugging" (default hotkey F5), or with the Debug sidebar. ![Debug sidebar instructions](readme/debug-example.png 'Debug sidebar')
|
||||||
|
9. You should have automatically forwarded ports, so the only thing remaining is opening browser window with the url provided in terminal.
|
||||||
|
|
||||||
# if you need to reset built static files and/or postgres database:
|
#### Everything else (docker)
|
||||||
docker-compose up --build --renew-anon-volumes
|
|
||||||
```
|
|
||||||
|
|
||||||
### Troubleshooting
|
1. Run `docker compose up`. This will create a production-ready setup with gunicorn. out of the box.
|
||||||
|
|
||||||
- https://askubuntu.com/q/615394/413683
|
### Everything else (python)
|
||||||
|
|
||||||
## New docs (WIP):
|
1. Get python3
|
||||||
|
2. `pip install -r requirements.txt`
|
||||||
|
3. `python3 manage.py migrate`
|
||||||
|
4. `python3 manage.py collecstatic`
|
||||||
|
5. `python3 manage.py runserver 0.0.0.0:8000`
|
||||||
|
|
||||||
|
## New docs (WIP)
|
||||||
|
|
||||||
Spejstore is a simple inventory system made for Warsaw Hackerspace purposes. Includes some features very specific to hswaw requirements, which are:
|
Spejstore is a simple inventory system made for Warsaw Hackerspace purposes. Includes some features very specific to hswaw requirements, which are:
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@ version: "3"
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: postgres:15.4
|
image: postgres:15.4
|
||||||
restart: always
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- spejstore-db:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=postgres
|
- POSTGRES_USER=postgres
|
||||||
- POSTGRES_PASSWORD=postgres
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
@ -16,13 +18,18 @@ services:
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
restart: always
|
restart: unless-stopped
|
||||||
command: bash -c "python manage.py collectstatic --no-input --clear && python manage.py migrate && gunicorn --workers 1 --threads 4 -b 0.0.0.0:8000 --capture-output --error-logfile - --access-logfile - spejstore.wsgi:application"
|
command: bash -c "python manage.py collectstatic --no-input --clear && python manage.py migrate && gunicorn --workers 1 --threads 4 -b 0.0.0.0:8000 --capture-output --error-logfile - --access-logfile - spejstore.wsgi:application"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
- /code/build_static
|
- /code/build_static
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
volumes:
|
||||||
|
spejstore-db:
|
||||||
|
external: false
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
After Width: | Height: | Size: 152 KiB |
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Loading…
Reference in New Issue