4. Running MyFin
On this page
4.1 Get the services up and running
Create a directory for Myfin to use, Myfin will write its configuration and data to this directory. (You need to have at least 5GB of disk space)
examples,
on Windows:
Create a folder on the C drive called "Myfin"
on Linux:
mkdir -p "/docker/myfin"
on MacOs:
Create a folder in the users "Documents" folder called "Myfin"
In the folder you created, create a file called:
docker-compose.yml
Copy and pasted the following into that file:
services:
myfin:
image: <image version>
container_name: myfin
restart: always
expose:
- "${INTERNAL_PORT}"
depends_on:
db:
condition: service_healthy
env_file:
- .env
volumes:
# Your license file, kept outside the container so it survives updates
- ./license:/root/.myfin/license
networks:
- frontend
- backend
db:
container_name: myfin_db
image: mysql:latest
restart: always
environment:
MYSQL_DATABASE: ${DATABASE_NAME}
MYSQL_USER: ${DATABASE_USER}
MYSQL_PASSWORD: ${DATABASE_PASSWORD}
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
MYSQL_ROOT_HOST: "%"
volumes:
- ./db_data:/var/lib/mysql
networks:
- backend
healthcheck:
test:
[
"CMD",
"mysqladmin",
"ping",
"-h",
"localhost",
"-u",
"root",
"-p${DATABASE_ROOT_PASSWORD}",
]
interval: 5s
timeout: 5s
retries: 20
start_period: 30s
npm:
image: jc21/nginx-proxy-manager:latest
container_name: nginx_proxy_manager
restart: always
ports:
- "80:80"
- "81:81"
- "443:443"
volumes:
- ./npm/data:/data
- ./npm/letsencrypt:/etc/letsencrypt
depends_on:
- myfin
networks:
- frontend
cloudflared:
image: cloudflare/cloudflared:latest
container_name: cloudflared
restart: always
command: tunnel run
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}
depends_on:
- npm
networks:
- frontend
networks:
frontend:
driver: bridge
backend:
driver: bridge
internal: truemake sure to change <image version> with the correct software version.
If you are using a subscription license use the following image:
image: myfin/subscription:latestof you are using a perpetual license use the version your license if for, for example:
image: myfin/V0:latest
or
image: myfin/V1:latest
etcSave and close the file
In this docker-compose file, we have the MyFin service, the SQL service and then an Nginx Proxy manager service.
In the same folder, create a file called .env
Copy and pasted in the following into that file:
# The internal and external ports to use
INTERNAL_PORT=3000
# name of domain you access MyFin from, eg http://localhost:3000, https://myfin-pc.local, http://192.168.0.250 etc
DOMAIN_URL=<Your domain or IP address>
# Set to 0 if you are using a trusted certificate for SSL (https), set to 1 if using self signed
ALLOW_SELF_SIGNED_CERTS=1
# The database: DATABASE_HOST is the name of the database service in the compose file
DATABASE_HOST=db
DATABASE_PORT=3306
DATABASE_USER=myfin_user
DATABASE_PASSWORD=<a long user password>
DATABASE_NAME=myfin
DATABASE_ROOT_PASSWORD=<a long root user password>
# REQUIRED: MyFin won't start without it. Keeps everyone's sign-in safe.
# A random secret of at least 32 characters that only you know: anyone who has it can sign in as any user.
# Keep the same value across updates: changing it signs everyone out.
# Make one with the command for your computer, then paste it below:
# Linux / macOS terminal: openssl rand -base64 48
# Windows PowerShell: $b = New-Object byte[] 48; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b); [Convert]::ToBase64String($b)
AUTH_SECRET=<a long random secret>
# Used to encrypt your SMTP password
SMTP_ENCRYPTION_KEY=<A 64 char random sting of numbers and chars>
# To enable or disable email sending
EMAIL_SEND_MAIL=<true or false>
# SMTP for User invites, password resets etc etc
EMAIL_SENDER_HOST=
EMAIL_SENDER_PORT=
EMAIL_SENDER_USER=
EMAIL_SENDER_PASS=<App Password if using gmail>
# Passkeys: your domain name without http / https, eg your-server.com, localhost, 192.168.0.250.
# Leave it commented out to use the address you open MyFin on. Changing it later stops existing passkeys working.
#RP_ID=your-server.com
# Log in session length
AUTH_SESSION_HOURS=9
CLOUDFLARE_TUNNEL_TOKEN=Fill in your desired and required details. So set the passwords, fill in your SMTP details and your domain details.
AUTH_SECRET is required: MyFin won’t start without a random secret of at least 32 characters. See Making the AUTH_SECRET for how to make one, including on Windows.
Remember to add your Cloudflare Tunnel token from the previous “Create a Cloudflare Tunnel” step:
CLOUDFLARE_TUNNEL_TOKEN=eyJhIjoiZmY5...Save and close the file
Everything is ready to start the Myfin service.
In the same folder open up your terminal and run the following command
docker compose up -dThis process may take several minutes, so give it a bit of time to get started.