TradeNote-SelfHost is a user-friendly CLI tool that enables traders to host and use TradeNote, an open-source trading journal, without dedicated hardware by running it in GitHub Codespaces. The CLI simplifies data backup and restoration, and the make
commands work on any Linux or macOS system with the required dependencies (e.g., Docker).
- Documentation and code to support hosting on MacOS or any linux machine
- Instructions on how to set forked repo to private
- Create a new make directive
update-src-deps
to allow update from this repository after forked repo is private
To run TradeNote-SelfHost, ensure you have:
- a GitHub account to use Codespaces (No additional software requirements)
- Linux/macOS:
- Docker installed with
docker compose
plugin. Use brew-install-docker-compose - GIT cli is installed with
git-lfs
plugin installed. Use brew-install-git-lfs
- Docker installed with
-
Fork the Repository:
-
Start TradeNote:
-
Log In:
- Use the default credentials defined in the
Makefile
variableTN_USER
(username and password are the same).- Default is:
tn@tn
- Default is:
- Alternatively, create a new user via the TradeNote interface.
- Use the default credentials defined in the
Here are the primary make
commands you need:
make start
:- Starts the TradeNote service.
make backup
:- Creates a backup of your data as a
.tar.gz
file, stored in./backup/tradenote_db_backup.tar.gz
. - Tip: Commit this file to your GitHub repository periodically to secure your backup.
- Creates a backup of your data as a
make restore
:- Restores your data from the backup file in a new Codespace instance (e.g., after GitHub deletes an inactive Codespace after 30 days).
If you need to start a new Codespace instance:
- Fork the repository and launch a new Codespace (as described above).
- Copy your backup file (
tradenote_db_backup.tar.gz
) to the./backup
directory or pull from your git repository. - Run:
make restore
TradeNote-SelfHost includes Mongo Express, a web-based interface for viewing and managing your TradeNote database (if needed)
-
Start the Service:
-
Log In:
- Use the default credentials defined in the
docker-compose.yml
file:- Username:
tn
- Password:
tn
- Username:
- Use the default credentials defined in the
-
Usage:
- Mongo Express allows you to browse, edit, or query your TradeNote database directly from the web interface.
- Note: Be cautious when modifying data, as changes are applied directly to the database.
Running TradeNote in GitHub Codespaces is secure, as access to the Codespace URI is restricted to the GitHub user who owns the repository. This inherently protects the default credentials for TradeNote and Mongo Express (defined in docker-compose.yml
). However, to ensure your data remains secure, follow these best practices:
- Keep Your Repository Private: Ensure your GitHub repository is set to private to prevent unauthorized access to your backup file (
./backup/tradenote_db_backup.tar.gz
) if you commit it to the repository. - Limit Codespace Access: Only share Codespace access with trusted collaborators via GitHub repository permissions.
- Secure Backup Storage: If committing backups to GitHub, consider encrypting the backup file (
tradenote_db_backup.tar.gz
) before committing to add an extra layer of security. - Monitor Codespace Usage: Regularly check your GitHub Codespaces for active instances, as inactive instances are deleted after 30 days, potentially requiring data restoration.
By following these steps, you can minimize security risks and safely use TradeNote in Codespaces.
Forked repositories on GitHub are public by default, which can pose a security risk if you commit sensitive files like your TradeNote database backup (tradenote_db_backup.tar.gz
). To protect your data, convert your forked repository to private by making it standalone first. Follow these steps:
- Navigate to Repository Settings: Go to your forked
tradenote-selfhost
repository on GitHub and click on the Settings tab at the top. - Leave the Fork Network: Scroll down to the Danger Zone section at the bottom of the General settings page. Click the Leave fork network button to unlink your repository from the original fork network, transforming it into a standalone repository. Confirm the action when prompted.
- Change Visibility: Once unlinked, the Change visibility button in the Danger Zone will become available. Click it, select Change to private, and confirm the change. Your repository is now private and inaccessible to the public.
After converting your forked repository to private, you may still want to incorporate updates from the original tradenote-selfhost repository. To do this, use the make command:
make update-src-deps
- Preserves Your Files: Any additional files or folders you created will remain untouched.
- Overwrites Matching Files: If files exist both in your repository and the upstream source, they will be overwritten with the latest version.
- Best Practice: Before committing changes to your private repository, run a git diff to review modifications and ensure nothing important is unintentionally overwritten.
This project is dedicated to the memory of @paulgoh, my collegue, my friend and my brother who was meant to be the first user of TradeNote-SelfHost. RIP 💙