diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-10-14 17:14:31 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-10-14 17:14:31 -0400 |
| commit | ff2970921da22fef7c149f5d565644c44991c4a3 (patch) | |
| tree | 3a5775fcf26232d423dca7ae19275c029ca82077 | |
| parent | 067f8f92b568527e94e2a04fa495f86f1820a4bc (diff) | |
| download | dispatch-tracker-ff2970921da22fef7c149f5d565644c44991c4a3.tar.gz dispatch-tracker-ff2970921da22fef7c149f5d565644c44991c4a3.tar.xz | |
Adjust the documentation.
| -rw-r--r-- | README.md | 156 |
1 files changed, 27 insertions, 129 deletions
@@ -1,155 +1,53 @@ # dispatch-tracker -Most of the features are here and the application should fulfill the use -case at this time. +A slightly older version of this application is still in use for one of +the companies I wrote this for some number of years ago. + +Most of the features are here and the application fulfills the use case. ## Things to fix/add going forward: - * Friendly Error pages + * More friendly error pages * Description format field for customer objects & - * on load create page dynamically pull in cursomter description format + * on load create page dynamically pull in customer description format and display above the form field * Upload Invoice logos on Identity Objects for use in Invoices * Change Name To "Load Pay System" -- we're going to think about it * Freight Invoicing System - * Figure out if auditlog timestamps are fucked or not with timezones - - -## To get a development system setup: - -Not strictly part of the Django app, but worth noting that if you have -Postgres installed locally but don't want to muck with permissions, service -etc it's as simple as: - -```bash -pg_ctl -D pg_data initdb -pg_ctl -D pg_data -l pg_log start -echo create database $(id -un)\; | psql postgres -echo create database dispatch | psql -``` - -Your user should be able to connect with just a simple `psql` - -You will need to install - - -Void Linux: -``` -xbps-install base-devel python3-devel postgresql-libs-devel -``` - -Alpine Linux: -``` -apk add git python3 py3-setuptools py3-virtualenv postgresql-client -# This set can be optionally removed when the virutalenv is built -apk add linux-headers postgresql-dev gcc python3-dev libc-dev -``` - - -``` bash -cd app -python3 -m venv env -. env/bin/activate -pip install -r requirements.txt -cp config-example.yml config.yml -sed -i.bak -e"s/USER: postgres$/USER: $(id -un)" config.yml -python3 ./manage.py migrate -python3 ./manage.py createsuperuser -python3 ./manage.py setup_identity -# This will create some fake records if you wish -./manage.py insert_fake_data --companies 10 --users 10 \ - --loads 400 --start-date='-16w' --end-date='+16w' --attachments=true \ - --invoices=true - # Default is 2 weeks for start/end date, no - # defaults for any other options -# Run a local development server, listens to the world -./manage.py runserver 0.0.0.0:8080 -``` - + * Add in an audit log again. ( I ripped it out rather than trying to port it + to Django 3.2 ) +## Docker Environment setup -## To get a production system setup: - -Alpine Linux is used as the example, but it should be similar for most systems: - -``` bash -# psql -U postgres -postgres=# create role dispatch with login password 'mypass'; -postgres=# create database dispatch with owner dispatch; -postgres=# \q -# export _u="dispatch" -$ export _home="/var/dispatch" -# addgroup -S "$_u" -# adduser -h "$_home" -G "$_u" -S -D "$_u" -# # Add Nginx to the dispatch group, on Alpine you must edit /etc/group - # since `gpasswd` doesn't exist. This is so Nginx can see the socket - # But your application can't see everything else Nginx does. -$ chmod 751 "$_home" -# su -s /bin/sh "$_u" -$ . /etc/profile -$ cd -$ git clone https://git.riedstra.us/mitch/dispatch-tracker.git -$ cd dispatch-tracker/app -$ python3 -m virtualenv env -$ . env/bin/activate -$ pip install -r requirements.txt -$ cp config-example.yml config.yml -$ vi config.yml # Set database credentials. Allowed hosts, Debug: false, - # secret key, static root, etc -$ python3 ./manage.py collectstatic -$ python3 ./manage.py migrate -$ python3 ./manage.py createsuperuser -$ uwsgi --processes=1 --threads=4 \ - --socket=/tmp/dispatch-tracker.sock \ - --chmod-socket=664 --module wsgi:application -``` +Out of the box you should be able to run: -Now install the Nginx configuration, careful to use -`unix:/tmp/dispatch-tracker.sock` for `uwsgi_pass`. - -If you're using `runit` you can use the following script for the service: - -```bash -#!/bin/sh - -_user="dispatch_demo" -_app_pth="/var/dispatch/dispatch-tracker/app/" -_socket="/tmp/dispatch-tracker.sock" - -exec chpst -u "$_user" sh -c " - set -e - cd \"$_app_pth\"; - . env/bin/activate; - exec uwsgi \ - --die-on-term \ - --processes=1 \ - --threads=4 \ - --socket=\"$_socket\" \ - --chmod-socket=664 \ - --module wsgi:application - " +```shell +$ docker build -t dispatch-tracker:latest . ``` +To build a container that will start up a demo version of the application. -## Docker Environment setup +This demo container runs: -A quasi production esque setup using `uwsgi` + * Nginx + * uwsgi + * postgresql -``` -./docker-compose up -d -``` +The container image has numerous configuration options via environment +variables. Check out the `entrypoint.sh` file for more information on the +specifics there. -Then +With a few tweaks it should be suitable for production deployments, though +you'll want to disable the embedded Postgres database and use a separate server, +ideally with failover. -``` -sh docker-scripts/setup.sh -``` -Docker compose is configured to bring up the Nginx instance on -http://172.21.23.2 If you're on Windows or MacOS I'm told can't access it -directly via IP, so https://localhost:36200 should work instead. +## To get a development system setup: +It's a pretty straightforward Django application, `requirements.txt` should +point you in the right direction there, `app/settings.py` can be adjusted +to point at whatever database back end you choose via environment variables. # Misc |
