A simple, end-to-end bookkeeping solution: record transactions, generate accurate reports, file directly to the CRA, and seamlessly hand off to your accountant for approval — all in one place.
- Mail Dev - MailDev
- MailDev Docker Image
-
In the
apifolder. -
Create a
.env.developmentfile with the following content:TODO
See
docker-compose.development.yml->x-default-environmentfor optional values that you can customize as needed. -
Set up the
devcommand, or usedocker compose -f docker-compose.development.ymlinstead ofdevin all instructions. -
Boot the api, web, and db services via
dev up --watchordev watchordocker compose -f docker-compose.development.yml up --watch. This will run the boot pipeline and create the database, run migrations, and run seeds. -
Stop the api, web, and db services via
ctrl+cordev downor if you want to wipe the databasedev down -v. -
Install local dependencies by installing
asdfand node viaasdfand then runningnpm installat the top level of the project. -
To get the local per-service node_modules, so your code editor gets linting and types, do
cd api && bundle installandcd web && npm install.
-
Boot only the api service using:
dev up api # or docker compose -f docker-compose.development.yml up --watch api # or cd api npm run start
-
Access the api by logging in to the front-end, then going to http://localhost:3000
-
Boot only the web service using:
dev up web # or docker compose -f docker-compose.development.yml up --watch web # or cd web npm run start
-
Log in to the front-end service at http://localhost:8080
-
Boot only the db service using:
dev up db # or docker compose -f docker-compose.development.yml up --watch dbMigrations run automatically, as do seeds. NOTE: production and development have different seeds.
-
You can access the
psqlcommand line viadev psql # or docker compose -f docker-compose.development.yml exec db sh -c ' PGPASSWORD="$DB_PASSWORD" psql \ --host "$DB_HOST" \ --username "$DB_USERNAME" \ --dbname "$DB_DATABASE" '
- Access the web interface at http://localhost:1080
If you are getting a bunch of "Login required" errors in the console, make sure that you have disabled any kind of enhanced tracking protection.
Auth0 use third-party cookies for authentication, and they get blocked by all major browsers by default.
- Run the api test suite via
dev test_api.
See api/tests/README.md for more detailed info.
This project now uses Rails Active Record migrations. Naming conventions should continue to follow snake_case for database tables and columns.
-
To generate a new migration run:
dev rails generate migration CreateUsersTable
Replace
CreateUsersTablewith a descriptive migration class name. Generated files will appear underapi/db/migrate/.If you are using Linux, always run generators through the
dev railswrapper to avoid file permission issues inside Docker containers. -
To apply all pending migrations run:
dev rails db:migrate
-
To rollback the most recent migration run:
dev rails db:rollback
-
To rollback all migrations and reapply them run:
dev rails db:migrate:reset
Seeding relies on Rails db/seeds files located under api/db/. Place shared data in api/db/seeds.rb, and environment-specific logic in files such as api/db/seeds/development.rb and api/db/seeds/production.rb.
-
To execute the default seed script run:
dev rails db:seed
-
To truncate tables and reseed from scratch run:
dev rails db:seed:replant
-
To run seeds for a specific environment set
RAILS_ENVexplicitly:RAILS_ENV=production dev rails db:seed
Seeds remain environment-scoped, enabling minimal defaults in production and richer fixtures in development. Rails seeds do not track execution history, so keep every seed operation idempotent to ensure it is safe to rerun at any time.
If you want to take over a directory or file in Linux you can use dev ownit <path-to-directory-or-file>.
If you are on Windows or Mac, and you want that to work, you should implement it in the bin/dev file. You might never actually need to take ownership of anything, so this might not be relevant to you.
The dev command vastly simplifies development using docker compose. It only requires ruby; however, direnv and asdf will make it easier to use.
It's simply a wrapper around docker compose with the ability to quickly add custom helpers.
All commands are just strings joined together, so it's easy to add new commmands. dev prints out each command that it runs, so that you can run the command manually to debug it, or just so you learn some docker compose syntax as you go.
-
(optional) Install
asdfas seen in https://asdf-vm.com/guide/getting-started.html.e.g. for Linux
apt install curl git git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0 echo ' # asdf . "$HOME/.asdf/asdf.sh" . "$HOME/.asdf/completions/asdf.bash" ' >> ~/.bashrc
-
Install
rubyviaasdfas seen here https://github.com/asdf-vm/asdf-ruby, or using whatever custom Ruby install method works for your platform.e.g. for Linux
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git # install version from .tool-versions file asdf install ruby asdf reshim rubyYou will now be able to run the
./bin/devcommand. -
(optional) Install direnv and create an
.envrcwith#!/usr/bin/env bash PATH_add binand then run
direnv allow.You will now be able to do
dev xxxinstead ov./bin/dev xxx.
TODO
Files:
- Dockerfile
- docker-compose.yml
- Non-commited
.envfile
-
Create a
.envfile in top level directory with the appropriate values.TODO
-
(optional) If testing build arguments do
dc build --build-arg RELEASE_TAG=2024.01.8.1 --build-arg GIT_COMMIT_HASH=532bd759c301ddc3352a1cee41ceac8061bfa3f7
or
dc build \ --build-arg RELEASE_TAG=$(date +%Y.%m.%d) \ --build-arg GIT_COMMIT_HASH=$(git rev-parse HEAD)
and then in the next step drop the
--buildflag. -
Build and boot the production image via
docker compose up --build
-
Go to http://localhost:3000/ and log in.
-
Navigate around the app and do some stuff and see if it works.
- https://nektosact.com/installation/gh.html
- https://github.com/cli/cli/blob/trunk/docs/install_linux.md
- Install GitHub CLI, via:
See https://github.com/cli/cli/blob/trunk/docs/install_linux.md NOTE:
sudo apt install gh
snapversion ofghhas permission limits, and will not work correctly, so use theaptversion instead. - Install GitHub publish library via:
See https://nektosact.com/installation/gh.html
gh extension install https://github.com/nektos/gh-act
- Generate secrets file via:
./bin/build-github-act-secrets-file.sh
- Run publish action via:
Wait a long time, this will be very slow and not show much progress.
gh act push \ -P ubuntu-latest=-self-hosted \ --job build \ --env PUSH_ENABLED=false \ --secret-file .secrets
- Check that the secrets built correctly:
docker run --rm -it \ --entrypoint /bin/sh \ some.repo/solid-fm-accounting:<LATEST_TAG>