A sleek, modern, ree & self-hosted group expense tracking app.
Try it here!
Clone the repository and install the necessary dependencies:
git clone git@github.com:tomginsberg/xpnz.git
cd xpnz
npm install
Build the project using the following command:
npm run build
Create a service file for the backend and configure it to start on system boot.
-
Create the Service File:
Navigate to the systemd directory and create a new service file:
cd /etc/systemd/system sudo vim xpnz.service
-
Add the Following Contents to the Service File:
[Unit] Description=Run the xpnz backend service After=network.target [Service] WorkingDirectory=/path/to/xpnz ExecStart=npm run api User=root Group=root [Install] WantedBy=multi-user.target
- Replace
/path/to/xpnz
with the actual path to your project directory.
- Replace
-
Reload the Systemd Manager Configuration:
sudo systemctl daemon-reload
-
Start the Service:
sudo systemctl start xpnz.service
-
Enable the Service to Start Automatically on Boot:
sudo systemctl enable xpnz.service
-
Check the Status of the Service:
sudo systemctl status xpnz.service
Ensure Caddy is installed on your server. Follow the official installation instructions if necessary.
-
Create a Caddyfile:
Navigate to the directory where you want to store your Caddyfile:
cd /etc/caddy sudo vim Caddyfile
Add the following contents to the Caddyfile:
your_domain { root * /path/to/xpnz/dist file_server @notStatic { not file } rewrite @notStatic /index.html encode gzip }
- Replace
your_domain
with your actual domain name. - Replace
/path/to/xpnz/dist
with the actual path to your project'sdist
directory.
- Replace
-
Set Up Systemd Service for Caddy:
Ensure the systemd service file for Caddy is set up to start on boot. Create or edit the file:
sudo vim /etc/systemd/system/caddy.service
Add the following content:
[Unit] Description=Caddy web server After=network.target [Service] ExecStart=/usr/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile Restart=on-failure [Install] WantedBy=multi-user.target
- Ensure the
ExecStart
andExecReload
paths match the actual path where Caddy is installed.
- Ensure the
-
Enable and Start Caddy:
Reload the systemd manager configuration to recognize the new service:
sudo systemctl daemon-reload
Start the Caddy service:
sudo systemctl start caddy
Enable the service to start automatically on boot:
sudo systemctl enable caddy
Check the status of the service to verify it's running:
sudo systemctl status caddy
-
Check the Deployment:
Open your web browser and navigate to
your_domain
. Your website should now be live and served by Caddy.
-
If you encounter issues, you can check the logs for more details using:
sudo journalctl -u caddy.service
-
Ensure your DNS records are correctly set up to point to your server's IP address.
By following these steps, you should have your website deployed and running with Caddy.