# Citadel
*Citadel allows you to run a Bitcoin Lightning node or a personal server on a Raspberry Pi. Citadel is proudly Free and open-source software (FOSS). Anyone is free to use, copy, study, and change the software in any way.*
https://runcitadel.space/
## Setup
### [Install Citadel on Ubuntu](https://runcitadel.space/x86)
```bash
# Dependencies
sudo apt -y install git curl jq rsync fswatch python3-jsonschema python3-dacite python3-semver python3-requests python3-yaml
# Install Docker
curl -fsSL https://get.docker.com | sh
# Verify docker can run
sudo docker run hello-world
# Clone the repository
git clone https://github.com/runcitadel/core.git citadel
# Start citadel
cd citadel
sudo ./scripts/start
```
Configure autostart on system startup
```bash
# Stop citadel
sudo ./scripts/stop
# Requires root to save
vim /etc/systemd/system/citadel-startup.service
```
`/etc/systemd/system/citadel-startup.service`
```text
[Unit]
Description=Citadel Service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=forking
Restart=always
RestartSec=1
ExecStart=/home/<username>/citadel/scripts/start
ExecStop=/home/<username>/citadel/scripts/stop
[Install]
WantedBy=multi-user.target
```
- replace `<username>` with username
- Make sure the exec dirs correctly point to the binary
Reload units
```bash
sudo systemctl daemon-reload
```
Start the service, confirm it works correctly by visiting the dashboard
```bash
sudo systemctl start citadel-startup.service
```
Enable Citadel to run automatically at system start
```bash
sudo systemctl enable citadel-startup.service
```
(Optional)
Stop the service
```bash
sudo systemctl stop citadel-startup
```
## Usage
Run commands from `citadel` folder
Start (non-daemonized)
```bash
sudo ./scripts/start
```
Stop (non-daemonized)
```bash
sudo ./scripts/stop
```
Start (daemonized)
```bash
sudo systemctl start citadel-startup.service
```
Stop (daemonized)
```bash
sudo systemctl stop citadel-startup.service
sudo ./scripts/stop
```
- Stopping the systemd service doesn't actually stop everything, so need to run both commands here