rhaamo / StockazIO

Components/hardware management webapp for DIYers.
https://demo.stockazio.squeaky.tech/public/parts
GNU Affero General Public License v3.0
18 stars 1 forks source link
electronic inventory inventory-management stock

StockazIO

Manage your inventory of electronic stuff

Features

Requirements

API Documentation

After installing the backend, Swagger documentation will be accessible at:

A better guide for the Oauth2 Auth flow is available here.

Install - manual

We assume in here you are installing under the stockazio user with default home directory /home/stockazio, like by doing:

useradd -m -s /bin/bash stockazio

API Backend

sudo su - stockazio
git clone https://github.com/rhaamo/StockazIO/ stockazio
cd stockazio
python3.8 -m virtualenv -p python3.8 venv
source venv/bin/activate
pip install --requirement api/requirements.txt
# For production environment
cp deploy/env.prod.sample .env
$EDITOR .env
# For local development see the other section
cd api
python manage.py collectstatic
# don't forget to run migrations
python manage.py migrate
# and then seed some initial datas (categories, manufacturers, footprints, ...)
python manage.py seeds_database
# create a superuser
python manage.py createsuperuser

You can uses deploy/stockazio-server.service for your systemd service.

NodeJS warning

You might need to uses thoses commands because of weird things in NodeJS and incompatibilities...

If using NodeJS 16.x uses the following commands for the frontend instead of the other ones:

CXXFLAGS="--std=c++14" yarn install
do yarn build classic

For NodeJS 17.x:

CXXFLAGS="--std=c++14" yarn install
NODE_OPTIONS=--openssl-legacy-provider yarn build

The build might also fails related to memory (https://github.com/vitejs/vite/issues/2433) so the workaround is:

node --max_old_space_size=16384 ./node_modules/vite/bin/vite.js build

Frontend

sudo su - stockazio
cd stockazio/front
yarn install
yarn build

Nginx

See the file deploy/stockazio-nginx.conf for a sample, don't forget you need all the location /xxx as the example to make it works.

Development

For local development, you always needs to export DJANGO_SETTINGS_MODULE=config.settings.local to have the right config:

cp deploy/env.dev.sample .env
$EDITOR .env
cd api
export DJANGO_SETTINGS_MODULE=config.settings.local
python manage.py ...

A sample config and extensions list for VScode are provided in api/.vscode/ and front/.vscode/, open two separate instance for front and api to use them.

Docker All-In-One image build

docker build -t stockazio-allinone -f Dockerfile-allinone .

Updating

Look at release changes first if anything is needed.

sudo su - stockazio
cd stockazio
source venv/bin/activate
git pull
cd front
yarn install
yarn build
cd ../api
pip install -r requirements.txt
python manage.py migrate

Then restart your stockazio-server service.

Install - docker All In One

You can use the Dockerfile-allinone to run StockazIO.

See the file ./deploy/env.prod.sample for the list of ENV variables you can use for the container.

You can copy that env file, edit it, and use --env-file your-env-file.prod for docker run/exec too.

The volume for uploads is /uploads.

To migrate the database:

docker exec -it stockazio python manage.py migrate

To seed database:

docker exec -it stockazio python manage.py seeds_database

To create your superuser:

docker exec -it stockazio python manage.py createsuperuser

Example build & run:

docker build -t stockazio-allinone -f Dockerfile-allinone .
docker run --net=host --name stockazio -it --rm --env-file .env -v /local/path/to/uploads:/uploads stockazio-allinone:latest

Install - docker split frontend & backend

TODO

Orders importer

It will by default import from 'ThisMonth', you can use --filter=LastMonth to fetch previous orders.

Available realistic and useful values for filtering: Today, ThisWeek, ThisMonth, LastMonth, ThisYear, LastYear and All.

You then will have to navigate to 'View - Order importer' in the web ui to manage orders: set a default vendor matching the ones in the db, set categories, manage the categories matchers, etc.

TODO List

Generated QRCodes format

Format changed but both URLs are handled by the search.

Changelog

Images sources

Contact

License

AGPL v3