Skip to content

Commit c8a4bf6

Browse files
committed
feat: add initial headless linux guide
1 parent 86da78c commit c8a4bf6

File tree

5 files changed

+198
-7
lines changed

5 files changed

+198
-7
lines changed

docs/guides/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Guides
3+
sidebar_label: Home
4+
sidebar_position: 0
5+
sidebar_class_name: hidden
6+
---
7+
8+
Here you can find various community contributed guides for common tasks/setups/configurations.
9+
10+
You can contribute your own, or suggest updates by clicking the 'Edit this page' link at the bottom of each page.

docs/guides/linux-headless.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
title: Headless Linux Server
3+
sidebar_label: Headless Linux Server
4+
sidebar_position: 1
5+
---
6+
7+
:::note
8+
This has been written and tested on Ubuntu 24.04, but should be translatable to other ubuntu/debian based distributions with little effort.
9+
It require CasparCG 2.5.0 or later, earlier versions do not support running without a x11 server.
10+
:::
11+
12+
The aim of this, is to setup a server to run CasparCG on startup, without needing any manual intervention or login or user session.
13+
14+
:::info
15+
This is quite barebones, and does not attempt to harden the setup in any way.
16+
Please contribute any tips or improvements you may have
17+
:::
18+
19+
## Basic system setup
20+
21+
1) Install Ubuntu 24.04 on your machine. You can choose the minimal install, and perform disk and other setup as you wish.
22+
23+
2) Ensure the system is fully updated
24+
`sudo apt update && sudo apt upgrade`
25+
26+
3) Install nvidia drivers
27+
`apt install nvidia-driver-570-server`
28+
29+
4) Install some common tools
30+
`apt install wget nano`
31+
32+
## Install Decklink drivers
33+
34+
1) Download these from the Blackmagic website. You may need to use the latest to ensure there aren't issues compiling against the kernel.
35+
To do so directly onto the server, you can start the download locally to determine a valid url and then perform that on the server with:
36+
`wget "some-url-here" -O Blackmagic_Desktop_Video_Linux.tar.gz`
37+
38+
2) Extract the drivers
39+
`tar -xvzf Blackmagic_Desktop_Video_Linux.tar.gz`
40+
41+
3) Install the needed package
42+
`sudo apt install -y Blackmagic_Desktop_Video_Linux/deb/x86_64/desktopvideo_*.deb`
43+
Make sure to not install the gui portion, or it will pull in a lot more dependencies than are necessary
44+
45+
## Install the server
46+
47+
### Specific version
48+
49+
1) Download CasparCG onto your machine, and extract the zip if there is any
50+
51+
2) Install the scanner
52+
`sudo apt install -y casparcg-scanner*.deb`
53+
54+
3) Install CEF
55+
`sudo apt install -y casparcg-cef*.deb`
56+
57+
4) Install CasparCG
58+
`sudo apt install -y casparcg-server*.deb`
59+
60+
### Latest version
61+
62+
An Ubuntu PPA is also maintained, which contains the latest version of each minor release: https://launchpad.net/~casparcg/+archive/ubuntu/ppa
63+
64+
If you are less particular about the version, and are ok with it being updated with your system updates, you can install from there instead:
65+
66+
1) Setup the PPA
67+
```
68+
sudo add-apt-repository ppa:casparcg/ppa
69+
sudo apt update
70+
```
71+
72+
2) Install the packages
73+
`sudo apt install -y casparcg-server casparcg-scanner`
74+
75+
:::tip
76+
You can install a specific minor version instead of the latest with `sudo apt install -y casparcg-server-2.4`.
77+
Multiple of these can be installed at once, each provides a binary named the same as the package
78+
:::
79+
80+
### Configure CasparCG
81+
82+
The exact path of the configuration is not too important, but you need to make sure that everywhere references the same. For simplicity, we shall do so under `/opt/casparcg`. You are free to put it elsewhere or split it up like is possible on windows.
83+
84+
1) Create a system user to run casparcg as
85+
`sudo adduser casparcg --system --no-create-home`
86+
87+
2) Create configuration directory
88+
`sudo mkdir /opt/casparcg && sudo chown casparcg /opt/casparcg`
89+
90+
3) Copy default configuration
91+
`sudo cp /usr/share/casparcg-server-beta/casparcg.config /opt/casparcg/`
92+
Note: the source path of this may be different, depending on what version you installed
93+
94+
4) Edit the config as required
95+
`sudo nano /opt/casparcg/casparcg.config`
96+
97+
### Setup autostart
98+
99+
1) Create scanner config
100+
`sudo nano nano etc/systemd/system/casparcg-scanner.service`
101+
With the content:
102+
```
103+
[Unit]
104+
Description=CasparCG Scanner
105+
106+
[Service]
107+
Type=simple
108+
User=casparcg
109+
#Group=
110+
WorkingDirectory=/opt/casparcg
111+
ExecStart=/usr/bin/casparcg-scanner
112+
Restart=on-failure
113+
[Install]
114+
WantedBy=default.target
115+
```
116+
117+
2) Create server config
118+
`sudo nano nano etc/systemd/system/casparcg-server.service`
119+
With the content:
120+
```
121+
[Unit]
122+
Description=CasparCG Server
123+
After=network-online.target
124+
Wants=network-online.target
125+
126+
[Service]
127+
Type=simple
128+
User=casparcg
129+
#Group=
130+
WorkingDirectory=/opt/casparcg
131+
ExecStart=/usr/bin/casparcg-server-beta
132+
Restart=on-failure
133+
134+
[Install]
135+
WantedBy=multi-user.target
136+
```
137+
Note: the name of the executable here may need changing to match the version of casparcg you have installed
138+
139+
3) Start everything
140+
```
141+
sudo systemctl daemon-reload
142+
sudo systemctl enable --now casparcg-scanner
143+
sudo systemctl enable --now casparcg-server
144+
```
145+
Note: you may need to reboot for it to start correctly.
146+
147+
## Recommended config changes
148+
149+
You should disable the builtin logging to disk, as journald will also be doing this for you.
150+
Update the `<log-path disable="true">log/</log-path>` line to set `disable` to `true`
151+
152+
If using CEF/HTML, you will likely want to enable gpu mode and setup a cache path
153+
```
154+
<html>
155+
<enable-gpu>true</enable-gpu>
156+
</html>
157+
```
158+
159+
## Debugging
160+
161+
If you want to more rapidly iterate on configuration, it can often be easier to disable the systemd launch, and start the server manually
162+
163+
```
164+
cd /opt/casparcg
165+
sudo systemctl stop casparcg-server
166+
167+
# edit the config
168+
nano casparcg.config
169+
casparcg-server-beta
170+
171+
# once done
172+
sudo systemctl start casparcg-server
173+
```

docusaurus.config.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ const config = {
4141
editUrl:
4242
"https://github.com/casparcg/casparcg.com/tree/main/",
4343
},
44-
blog: {
45-
showReadingTime: true,
46-
// Please change this to your repo.
47-
// Remove this to remove the "edit this page" links.
48-
editUrl:
49-
"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
50-
},
5144
theme: {
5245
customCss: require.resolve("./src/css/custom.css"),
5346
},
@@ -71,6 +64,12 @@ const config = {
7164
position: "left",
7265
label: "Downloads",
7366
},
67+
{
68+
type: "doc",
69+
docId: "guides/index",
70+
position: "left",
71+
label: "Guides",
72+
},
7473
{
7574
href: "https://casparcgforum.org",
7675
label: "Forum",
@@ -105,6 +104,10 @@ const config = {
105104
label: "Downloads",
106105
to: "/docs/downloads/server-client",
107106
},
107+
{
108+
label: "Guides",
109+
to: "/docs/guides",
110+
},
108111
{
109112
label: "Wiki",
110113
to: "https://github.com/casparcg/help/wiki",

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const sidebars = {
1616
// By default, Docusaurus generates a sidebar from the docs folder structure
1717
tutorialSidebar: [{ type: "autogenerated", dirName: "." }],
1818
downloads: [{ type: "autogenerated", dirName: "downloads" }],
19+
guides: [{ type: "autogenerated", dirName: "guides" }],
1920

2021
// But you can create a sidebar manually
2122
/*

src/css/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@
2828
--ifm-color-primary-lightest: #00ffff;
2929
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
3030
}
31+
32+
.theme-doc-sidebar-item-link.hidden {
33+
display: none;
34+
}

0 commit comments

Comments
 (0)