Manage your inventory of electronic stuff
After installing the backend, Swagger documentation will be accessible at:
A better guide for the Oauth2 Auth flow is available here.
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
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.
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
sudo su - stockazio
cd stockazio/front
yarn install
yarn build
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.
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 build -t stockazio-allinone -f Dockerfile-allinone .
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.
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
TODO
.env
file for Mouser/path/to/app/venv/bin/python /path/to/app/api/manage.py import_orders
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.
Format changed but both URLs are handled by the search.
web+stockazio:storageLocation,{uuid}
(old format: stockazio://storageLocation/{uuid}
)web+stockazio:part,{uuid}
(old format: stockazio://part/{uuid}
)python3 manage.py migrations_move_from_one_to_two_part_file_fields
AGPL v3