-
Make sure you have Node 16+ and Yarn installed.
-
Create a file
backend/config.json
with this content:{ "database": { "dialect": "sqlite", "storage": "andeolunch.db" } }
-
Create a file
app/.env
with this content:VUE_APP_BACKEND_URL=http://127.0.0.1:3000/api VUE_APP_BRANDING_TITLE="Andeo Lunch (DEV)"
-
Install all dependencies:
yarn install
-
In the directory
backend/
, run:bin/createUser # This will prompt for a username & password yarn serve:watch # Leave this running
-
In the directory
app/
, run:yarn serve # Leave this running
-
Visit
http://localhost:8080/
(or whatever URL step 6 showed). You should be able to log in using the username and password you created in step 5.
-
database
Configuration of the database to use. This is a sequelize config object.database.dialect
Type of database to use. In production only the value"mariadb"
is supported, and for development"sqlite"
is additionally supported.- (MariaDB only)
database.host
Hostname to connect to - (MariaDB only)
database.port
Port to connect to - (MariaDB only)
database.database
DB name - (MariaDB only)
database.username
Username - (MariaDB only)
database.password
Password - (SQLite only)
database.storage
Path to the SQLite database file. database.logSql
Enable SQL logging to the console.
The MariaDB configuration may omit any of
database
,username
orpassword
if desired, in which case the following environment variables will be read, allowing for easy integration with docker:- MARIADB_HOST
- MARIADB_PORT
- MARIADB_DATABASE
- MARIADB_USER
- MARIADB_PASSWORD
Additional, each of these with a _FILE suffix will also be checked, making it easy to use docker secrets.
-
port
Port to use, defaults to3000
. -
bind
Interface to bind to, defaults to"127.0.0.1"
-
lag
Artificial lag in milliseconds to delay each request. Allows simulating network lag. Practical hint: During development, set this to a small value like100
to simulate a realistic network lag which allows to more easily see quirks it causes in the app.
Run these from the root directory.
yarn check
Performs various checks that should be run before committing, including:- Check for duplicate Yarn packages
- Lint all the code
- Run the backend tests
Run these from the backend/
directory.
yarn serve
Launch backendyarn serve:watch
Launch backend with auto-reload on file changesyarn test
Run test suite using SQLiteyarn test:watch
Run test suite and re-run on every file changeyarn lint
Run linteryarn lint:fix
Run linter and fix automaticallytests/run-tests-with-mariadb.sh
Run test suite using MariaDB
These are also available in production:
bin/createUser
Create a new userbin/editUser
Edit a userbin/rebuild
Rebuild all transactions and all balancesbin/setPaymentInfo
Set up payment information for a userbin/validate
Validate the DB structure
Run these from the app/
directory.
yarn serve
Launch development server (with auto-reload on file change)yarn serve:public
Launch development server, binding to 0.0.0.0yarn build
Create a development build intodist/
yarn lint
Run linteryarn lint:fix
Run linter and fix automaticallyyarn ui
Launch Vue UI
Cypress tests are run against a full build running in docker images.
-
Build the docker images used for the Cypress tests:
./docker/build-docker-cypress.sh
-
Start the containers to obtain a fully functional Andeo Lunch instance:
./cypress/start-cypress-container.sh
-
Open the Cypress GUI
yarn workspace andeo-lunch-cypress run cypress:open
Important: Modifications to tests will have effect immediately, but modifications to the app or backend will not have effect and will require the image to be re-build and re-started.
To shut down the docker containers again:
./cypress/stop-cypress-container.sh