Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
3c6079807e | |||
b21d98ef73 | |||
2e55876076 | |||
dad3e6c1cf | |||
8c36855593 |
@ -10,6 +10,14 @@ pipeline:
|
|||||||
commands:
|
commands:
|
||||||
- mvn clean compile assembly:single
|
- mvn clean compile assembly:single
|
||||||
|
|
||||||
|
package:
|
||||||
|
image: maven:3-jdk-11
|
||||||
|
commands:
|
||||||
|
- apt update && apt install -y rpm
|
||||||
|
- mvn clean compile package -Dmaven.test.skip
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
gitea_release:
|
gitea_release:
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
settings:
|
settings:
|
||||||
@ -18,6 +26,8 @@ pipeline:
|
|||||||
base_url: https://git.metaunix.net
|
base_url: https://git.metaunix.net
|
||||||
title: "${CI_COMMIT_TAG}"
|
title: "${CI_COMMIT_TAG}"
|
||||||
files:
|
files:
|
||||||
- target/Dragoon-*.jar
|
- target/dragoon-*.jar
|
||||||
|
- target/dragoon-*.deb
|
||||||
|
- target/rpm/dragoon/RPMS/noarch/dragoon-*.rpm
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
|
148
pom.xml
148
pom.xml
@ -5,11 +5,35 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>tech.bitgoblin</groupId>
|
<groupId>tech.bitgoblin</groupId>
|
||||||
<artifactId>Dragoon</artifactId>
|
<artifactId>dragoon</artifactId>
|
||||||
<version>0.3.1</version>
|
<version>0.3.2</version>
|
||||||
|
|
||||||
<name>Dragoon</name>
|
<name>Dragoon</name>
|
||||||
<url>https://www.bitgoblin.tech</url>
|
<url>https://www.bitgoblin.tech</url>
|
||||||
|
<description>Automated video transcoder service.</description>
|
||||||
|
<inceptionYear>2022</inceptionYear>
|
||||||
|
|
||||||
|
<organization>
|
||||||
|
<name>Bit Goblin</name>
|
||||||
|
<url>https://www.bitgoblin.tech</url>
|
||||||
|
</organization>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<id>gballantine</id>
|
||||||
|
<name>Gregory Ballantine</name>
|
||||||
|
<email>gballantine@bitgoblin.tech</email>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>BSD</name>
|
||||||
|
<url>https://opensource.org/licenses/BSD-2-Clause</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
<comments>Simplified BSD license.</comments>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
@ -18,6 +42,11 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-cli</groupId>
|
||||||
|
<artifactId>commons-cli</artifactId>
|
||||||
|
<version>1.3.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.tomlj</groupId>
|
<groupId>org.tomlj</groupId>
|
||||||
<artifactId>tomlj</artifactId>
|
<artifactId>tomlj</artifactId>
|
||||||
@ -42,7 +71,6 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -99,6 +127,119 @@
|
|||||||
</descriptorRefs>
|
</descriptorRefs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.aerse.maven</groupId>
|
||||||
|
<artifactId>deb-maven-plugin</artifactId>
|
||||||
|
<version>1.16</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>package</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>package</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<unixUserId>dragoon</unixUserId>
|
||||||
|
<unixGroupId>dragoon</unixGroupId>
|
||||||
|
<debBaseDir>${project.basedir}/src/build/deb</debBaseDir>
|
||||||
|
<installDir>/opt</installDir>
|
||||||
|
<osDependencies>
|
||||||
|
<openjdk-11-jdk></openjdk-11-jdk>
|
||||||
|
<maven></maven>
|
||||||
|
<ffmpeg></ffmpeg>
|
||||||
|
</osDependencies>
|
||||||
|
<javaServiceWrapper>false</javaServiceWrapper>
|
||||||
|
<generateVersion>false</generateVersion>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<source>${basedir}/src/build/deb</source>
|
||||||
|
<target>/</target>
|
||||||
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<source>${basedir}/target/dragoon-${project.version}-jar-with-dependencies.jar</source>
|
||||||
|
<target>/opt/dragoon/dragoon.jar</target>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>rpm-maven-plugin</artifactId>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>generate-rpm</id>
|
||||||
|
<goals>
|
||||||
|
<goal>rpm</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<license>BSD 2-Clause</license>
|
||||||
|
<group>Applications/Multimedia</group>
|
||||||
|
<icon>src/main/resources/icon.gif</icon>
|
||||||
|
<packager>Bit Goblin</packager>
|
||||||
|
<prefix>/opt</prefix>
|
||||||
|
<changelogFile>${project.basedir}/src/build/changelog.txt</changelogFile>
|
||||||
|
<targetOs>linux</targetOs>
|
||||||
|
<mappings>
|
||||||
|
<mapping>
|
||||||
|
<directory>/opt/dragoon</directory>
|
||||||
|
<filemode>755</filemode>
|
||||||
|
<username>dragoon</username>
|
||||||
|
<groupname>dragoon</groupname>
|
||||||
|
</mapping>
|
||||||
|
<mapping>
|
||||||
|
<directory>/opt/dragoon/dragoon.jar</directory>
|
||||||
|
<filemode>755</filemode>
|
||||||
|
<username>dragoon</username>
|
||||||
|
<groupname>dragoon</groupname>
|
||||||
|
<sources>
|
||||||
|
<source>
|
||||||
|
<location>${basedir}/target/dragoon-${project.version}-jar-with-dependencies.jar</location>
|
||||||
|
</source>
|
||||||
|
</sources>
|
||||||
|
</mapping>
|
||||||
|
<mapping>
|
||||||
|
<directory>/etc/dragoon</directory>
|
||||||
|
<configuration>true</configuration>
|
||||||
|
<filemode>755</filemode>
|
||||||
|
<username>dragoon</username>
|
||||||
|
<groupname>dragoon</groupname>
|
||||||
|
<sources>
|
||||||
|
<source>
|
||||||
|
<location>${project.basedir}/src/build/deb/etc/dragoon</location>
|
||||||
|
</source>
|
||||||
|
</sources>
|
||||||
|
</mapping>
|
||||||
|
<mapping>
|
||||||
|
<directory>/etc/systemd/system/dragoon.service</directory>
|
||||||
|
<filemode>644</filemode>
|
||||||
|
<username>root</username>
|
||||||
|
<groupname>root</groupname>
|
||||||
|
<sources>
|
||||||
|
<source>
|
||||||
|
<location>${project.basedir}/src/build/deb/etc/systemd/system/dragoon.service</location>
|
||||||
|
</source>
|
||||||
|
</sources>
|
||||||
|
</mapping>
|
||||||
|
</mappings>
|
||||||
|
<requires>
|
||||||
|
<require>java-11-openjdk</require>
|
||||||
|
<require>ffmpeg</require>
|
||||||
|
</requires>
|
||||||
|
<preinstallScriptlet>
|
||||||
|
<script>echo "installing ${project.name} now"</script>
|
||||||
|
</preinstallScriptlet>
|
||||||
|
<postinstallScriptlet>
|
||||||
|
<scriptFile>src/build/scripts/postinstall.sh</scriptFile>
|
||||||
|
<fileEncoding>utf-8</fileEncoding>
|
||||||
|
<filter>true</filter>
|
||||||
|
</postinstallScriptlet>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
<version>2.5.2</version>
|
<version>2.5.2</version>
|
||||||
@ -117,6 +258,5 @@
|
|||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
1
src/build/changelog.txt
Normal file
1
src/build/changelog.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Check https://git.metaunix.net/bitgoblin/dragoon/releases for the current changelog
|
8
src/build/deb/etc/dragoon/config.example.toml
Normal file
8
src/build/deb/etc/dragoon/config.example.toml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# This example transcodes footage to DNxHD 1080p60 for use in video editors like DaVinci Resolve.
|
||||||
|
[transcoder]
|
||||||
|
repo_path = '~/videos' # location of the videos to transcode
|
||||||
|
video_format = 'mov' # video container format
|
||||||
|
video_codec = 'dnxhd' # video codec to use
|
||||||
|
video_parameters = 'scale=1920x1080,fps=60,format=yuv422p' # video extra format parameters flag - this will be broken later into separate attributes
|
||||||
|
video_profile = 'dnxhr_hq' # DNxHD has multiple presets for various video qualities
|
||||||
|
audio_codec = 'pcm_s16le' # audio codec to use
|
11
src/build/deb/etc/systemd/system/dragoon.service
Normal file
11
src/build/deb/etc/systemd/system/dragoon.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Dragoon video transcoder service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=dragoon
|
||||||
|
Group=dragoon
|
||||||
|
ExecStart=/usr/bin/java -jar '/opt/dragoon/dragoon.jar'
|
||||||
|
SuccessExitStatus=143
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
23
src/build/scripts/postinstall.sh
Normal file
23
src/build/scripts/postinstall.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
GETENT_USER=$(getent passwd dragoon)
|
||||||
|
GETENT_GROUP=$(getent group dragoon)
|
||||||
|
|
||||||
|
# Create the dragoon user if it doesn't already exist
|
||||||
|
if [ "$GETENT_USER" = "" ]; then
|
||||||
|
useradd -r dragoon
|
||||||
|
else
|
||||||
|
echo "The 'dragoon' user already exists, skipping creation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create the dragoon group if it doesn't already exist
|
||||||
|
if [ "$GETENT_GROUP" = "" ]; then
|
||||||
|
groupadd dragoon
|
||||||
|
usermod -aG dragoon dragoon
|
||||||
|
else
|
||||||
|
echo "The 'dragoon' group already exists, skipping creation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Change the directory ownership of /opt and /etc
|
||||||
|
chown -R dragoon:dragoon /etc/dragoon
|
||||||
|
chown -R dragoon:dragoon /opt/dragoon
|
@ -1,5 +1,7 @@
|
|||||||
package tech.bitgoblin;
|
package tech.bitgoblin;
|
||||||
|
|
||||||
|
import org.apache.commons.cli.ParseException;
|
||||||
|
import tech.bitgoblin.config.Cmd;
|
||||||
import tech.bitgoblin.config.Config;
|
import tech.bitgoblin.config.Config;
|
||||||
import tech.bitgoblin.transcoder.RunTranscoderTask;
|
import tech.bitgoblin.transcoder.RunTranscoderTask;
|
||||||
import tech.bitgoblin.transcoder.Transcoder;
|
import tech.bitgoblin.transcoder.Transcoder;
|
||||||
@ -12,13 +14,15 @@ import java.util.Timer;
|
|||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
private static final String configFile = "~/.config/dragoon.toml";
|
|
||||||
|
|
||||||
private static final int msToMinutes = 60 * 1000;
|
private static final int msToMinutes = 60 * 1000;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws ParseException {
|
||||||
|
// parse command-line options
|
||||||
|
Cmd cmd = new Cmd(args);
|
||||||
|
|
||||||
// read our config file
|
// read our config file
|
||||||
Config c = new Config(configFile);
|
Config c = new Config(cmd.getConfigPath());
|
||||||
|
|
||||||
// create new Transcoder object and start the service
|
// create new Transcoder object and start the service
|
||||||
Transcoder t = new Transcoder(c);
|
Transcoder t = new Transcoder(c);
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
|
30
src/main/java/tech/bitgoblin/config/Cmd.java
Normal file
30
src/main/java/tech/bitgoblin/config/Cmd.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package tech.bitgoblin.config;
|
||||||
|
|
||||||
|
import org.apache.commons.cli.*;
|
||||||
|
|
||||||
|
public class Cmd {
|
||||||
|
|
||||||
|
private String configPath = "/etc/dragoon/config.toml";
|
||||||
|
|
||||||
|
public Cmd(String[] args) throws ParseException {
|
||||||
|
Options options = new Options();
|
||||||
|
|
||||||
|
Option configPath = new Option("c", "configPath", true, "configuration file path (defaults to /etc/dragoon/config.toml)");
|
||||||
|
configPath.setRequired(false);
|
||||||
|
options.addOption(configPath);
|
||||||
|
|
||||||
|
CommandLineParser parser = new DefaultParser();
|
||||||
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
|
CommandLine cmd = parser.parse(options, args);
|
||||||
|
|
||||||
|
// set the configPath variable if the option was passed to the program
|
||||||
|
if (cmd.hasOption("configPath")) {
|
||||||
|
this.configPath = cmd.getOptionValue("configPath");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfigPath() {
|
||||||
|
return this.configPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package tech.bitgoblin.config;
|
package tech.bitgoblin.config;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package tech.bitgoblin.io;
|
package tech.bitgoblin.io;
|
||||||
|
|
||||||
import tech.bitgoblin.Logger;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class IOUtils {
|
public class IOUtils {
|
||||||
|
@ -4,11 +4,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.InterruptedException;
|
import java.lang.InterruptedException;
|
||||||
import java.lang.Process;
|
import java.lang.Process;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.util.Timer;
|
|
||||||
|
|
||||||
import tech.bitgoblin.Logger;
|
import tech.bitgoblin.Logger;
|
||||||
import tech.bitgoblin.config.Config;
|
import tech.bitgoblin.config.Config;
|
||||||
|
BIN
src/main/resources/icon.gif
Normal file
BIN
src/main/resources/icon.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
17
src/test/java/tech/bitgoblin/config/CmdTest.java
Normal file
17
src/test/java/tech/bitgoblin/config/CmdTest.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package tech.bitgoblin.config;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.apache.commons.cli.ParseException;
|
||||||
|
|
||||||
|
public class CmdTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldDefaultToEtc() throws ParseException {
|
||||||
|
Cmd cmd = new Cmd(new String[]{});
|
||||||
|
assertTrue(cmd.getConfigPath().equals("/etc/dragoon/config.toml"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,7 +8,6 @@ import org.junit.BeforeClass;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
|
|
||||||
@ -38,6 +37,7 @@ public class IOUtilsTest {
|
|||||||
public void fileShouldBeLocked() throws IOException {
|
public void fileShouldBeLocked() throws IOException {
|
||||||
RandomAccessFile raf = new RandomAccessFile(testFile, "rw");
|
RandomAccessFile raf = new RandomAccessFile(testFile, "rw");
|
||||||
assertTrue(IOUtils.isFileLocked(new File(testFile)));
|
assertTrue(IOUtils.isFileLocked(new File(testFile)));
|
||||||
|
raf.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user