added packaging for rpm

This commit is contained in:
Sebastian Sdorra
2020-04-21 07:38:35 +02:00
parent 3ab3eb43bd
commit 02f104a5ca
13 changed files with 1065 additions and 0 deletions

3
.gitignore vendored
View File

@@ -29,3 +29,6 @@ node_modules
# jrebel
rebel.xml
*.pyc
# vagrant
.vagrant

47
packaging/pom.xml Normal file
View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
MIT License
Copyright (c) 2020-present Cloudogu GmbH and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>sonia.scm</groupId>
<artifactId>scm</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<groupId>sonia.scm.packaging</groupId>
<artifactId>packaging</artifactId>
<packaging>pom</packaging>
<version>2.0.0-SNAPSHOT</version>
<name>packaging</name>
<modules>
<module>rpm</module>
</modules>
</project>

16
packaging/rpm/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,16 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/centos-8"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
config.vm.provision "shell", inline: <<-SHELL
yum install -y /vagrant/target/scm-server-*.rpm
SHELL
end

334
packaging/rpm/pom.xml Normal file
View File

@@ -0,0 +1,334 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
MIT License
Copyright (c) 2020-present Cloudogu GmbH and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>sonia.scm.packaging</groupId>
<artifactId>packaging</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<groupId>sonia.scm.packaging</groupId>
<artifactId>rpm</artifactId>
<packaging>rpm</packaging>
<version>2.0.0-SNAPSHOT</version>
<description>Packaging for RedHat/Centos/Fedora</description>
<name>rpm</name>
<dependencies>
<dependency>
<groupId>sonia.scm</groupId>
<artifactId>scm-server</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>copy-server</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/rpm/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
<execution>
<id>copy-jsvc</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>commons-daemon</groupId>
<artifactId>commons-daemon-native</artifactId>
<version>1.1.0</version>
<type>tar.gz</type>
<fileMappers>
<org.codehaus.plexus.components.io.filemappers.FlattenFileMapper/>
</fileMappers>
</artifactItem>
</artifactItems>
<includes>**/jsvc-linux-*</includes>
<outputDirectory>${project.build.directory}/rpm/libexec</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
<execution>
<id>copy-webapp</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>sonia.scm</groupId>
<artifactId>scm-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
<outputDirectory>${project.build.directory}/rpm/var/webapp</outputDirectory>
<destFileName>scm-webapp.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.dentrassi.maven</groupId>
<artifactId>rpm</artifactId>
<version>1.5.0</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<!-- don't attach RPM as a secondary artifact -->
<attach>false</attach>
<packageName>scm-server</packageName>
<group>Development/Tools</group>
<license>MIT</license>
<requires>
<require>java-11-openjdk-headless</require>
</requires>
<recommends>
<recommend>mercurial</recommend>
</recommends>
<beforeInstallation>
<file>src/main/scripts/before-installation.sh</file>
</beforeInstallation>
<afterInstallation>
<file>src/main/scripts/after-installation.sh</file>
</afterInstallation>
<!-- rule sets -->
<rulesets>
<ruleset>
<id>default</id>
<rules>
<rule>
<when>
<type>file</type>
<prefix>/opt/scm-server/lib</prefix>
</when>
<user>root</user>
<group>scm</group>
<mode>0644</mode>
</rule>
<rule>
<when>
<type>file</type>
<prefix>/opt/scm-server/libexec</prefix>
</when>
<user>root</user>
<group>scm</group>
<mode>0755</mode>
</rule>
</rules>
</ruleset>
</rulesets>
<entries>
<entry>
<name>/opt/scm-server/bin/scm-server</name>
<file>src/main/fs/opt/scm-server/bin/scm-server</file>
<user>root</user>
<group>scm</group>
<mode>0750</mode>
</entry>
<entry>
<name>/etc/default/scm-server</name>
<file>src/main/fs/etc/default/scm-server</file>
<user>root</user>
<group>scm</group>
<mode>0640</mode>
<configuration>true</configuration>
</entry>
<entry>
<name>/etc/scm/logging.xml</name>
<file>src/main/fs/etc/scm/logging.xml</file>
<user>root</user>
<group>scm</group>
<mode>0640</mode>
<configuration>true</configuration>
</entry>
<entry>
<name>/etc/scm/server-config.xml</name>
<file>src/main/fs/etc/scm/server-config.xml</file>
<user>root</user>
<group>scm</group>
<mode>0640</mode>
<configuration>true</configuration>
</entry>
<entry>
<name>/etc/systemd/system/scm-server.service</name>
<file>src/main/fs/etc/systemd/system/scm-server.service</file>
<user>root</user>
<group>root</group>
<mode>0644</mode>
</entry>
<entry>
<name>/opt/scm-server/lib</name>
<collect>
<from>${project.build.directory}/rpm/lib</from>
</collect>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/scm-server/libexec</name>
<collect>
<from>${project.build.directory}/rpm/libexec</from>
</collect>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/scm-server/var/webapp/docroot/index.html</name>
<file>src/main/fs/opt/scm-server/var/webapp/docroot/index.html</file>
<user>root</user>
<group>scm</group>
<mode>0644</mode>
</entry>
<entry>
<name>/opt/scm-server/var/webapp/scm-webapp.war</name>
<file>${project.build.directory}/rpm/var/webapp/scm-webapp.war</file>
<user>root</user>
<group>scm</group>
<mode>0644</mode>
</entry>
<entry>
<name>/var/log/scm</name>
<directory>true</directory>
<user>scm</user>
<group>scm</group>
<mode>0750</mode>
</entry>
<entry>
<name>/run/scm</name>
<directory>true</directory>
<user>scm</user>
<group>scm</group>
<mode>0750</mode>
</entry>
<entry>
<name>/opt/scm-server/var/log</name>
<linkTo>/var/log/scm</linkTo>
<user>scm</user>
<group>scm</group>
</entry>
<entry>
<name>/opt/scm-server/conf</name>
<linkTo>/etc/scm</linkTo>
<user>root</user>
<group>root</group>
</entry>
<entry>
<name>/var/lib/scm</name>
<directory>true</directory>
<user>scm</user>
<group>scm</group>
<mode>0750</mode>
</entry>
<entry>
<name>/var/cache/scm</name>
<directory>true</directory>
<user>scm</user>
<group>scm</group>
<mode>0750</mode>
</entry>
<entry>
<name>/var/cache/scm/work</name>
<directory>true</directory>
<user>scm</user>
<group>scm</group>
<mode>0750</mode>
</entry>
<entry>
<name>/opt/scm-server/work</name>
<linkTo>/var/cache/scm/work</linkTo>
<user>root</user>
<group>root</group>
</entry>
</entries>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<rpm.skipSigning>true</rpm.skipSigning>
</properties>
</project>

View File

@@ -0,0 +1,51 @@
#!/bin/sh
#
# MIT License
#
# Copyright (c) 2020-present Cloudogu GmbH and Contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# scm-server host interface
HOST=0.0.0.0
# scm-server port
PORT=8080
# change user
USER=scm
# home of scm-manager
export SCM_HOME=/var/lib/scm
# force jvm path
JAVA_HOME="/usr/lib/jvm/jre-11"
# path to pid
PIDFILE=/var/run/scm/scm.pid
# path to log directory
LOGDIR=/var/log/scm
# increase memory
# EXTRA_JVM_ARGUMENTS="$EXTRA_JVM_ARGUMENTS -Xms1g -Xmx1g"
# pass extra jvm arguments
EXTRA_JVM_ARGUMENTS="$EXTRA_JVM_ARGUMENTS -Djetty.host=$HOST -Djetty.port=$PORT"

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
MIT License
Copyright (c) 2020-present Cloudogu GmbH and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<!--
Document : logback.release.xml
Created on : February 3, 2011, 6:36 PM
Author : sdorra
Description:
Purpose of the document follows.
-->
<configuration>
<jmxConfigurator />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/log/scm/scm-manager.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>/var/log/scm/scm-manager-%i.log</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>10</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>10MB</maxFileSize>
</triggeringPolicy>
<append>true</append>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-10X{transaction_id}] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-10X{transaction_id}] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<logger name="sonia.scm" level="INFO" />
<logger name="com.cloudogu.scm" level="INFO" />
<!-- suppress massive gzip logging -->
<logger name="sonia.scm.filter.GZipFilter" level="WARN" />
<logger name="sonia.scm.filter.GZipResponseStream" level="WARN" />
<logger name="sonia.scm.util.ServiceUtil" level="WARN" />
<!-- event bus -->
<logger name="sonia.scm.event.LegmanScmEventBus" level="INFO" />
<!-- shiro -->
<!--
<logger name="org.apache.shiro" level="INFO" />
<logger name="org.apache.shiro.authc.pam.ModularRealmAuthenticator" level="DEBUG" />
-->
<!-- svnkit -->
<!--
<logger name="svnkit" level="WARN" />
<logger name="svnkit.network" level="DEBUG" />
<logger name="svnkit.fsfs" level="WARN" />
-->
<!-- javahg -->
<!--
<logger name="com.aragost.javahg" level="DEBUG" />
-->
<!-- ehcache -->
<!--
<logger name="net.sf.ehcache" level="DEBUG" />
-->
<root level="WARN">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
MIT License
Copyright (c) 2020-present Cloudogu GmbH and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="ScmServer" class="org.eclipse.jetty.server.Server">
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<!-- increase header size for mercurial -->
<Set name="requestHeaderSize">16384</Set>
<Set name="responseHeaderSize">16384</Set>
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
</Call>
</New>
<!--
Connectors
-->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server">
<Ref refid="ScmServer" />
</Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config">
<Ref refid="httpConfig" />
</Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="port">
<SystemProperty name="jetty.port" default="8080" />
</Set>
</New>
</Arg>
</Call>
<New id="scm-webapp" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/scm</Set>
<Set name="war">
<SystemProperty name="basedir" default="."/>/var/webapp/scm-webapp.war</Set>
<!-- disable directory listings -->
<Call name="setInitParameter">
<Arg>org.eclipse.jetty.servlet.Default.dirAllowed</Arg>
<Arg>false</Arg>
</Call>
<Set name="tempDirectory">/var/cache/scm/work/webapp</Set>
</New>
<New id="docroot" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="baseResource">
<New class="org.eclipse.jetty.util.resource.ResourceCollection">
<Arg>
<Array type="java.lang.String">
<Item>
<SystemProperty name="basedir" default="."/>/var/webapp/docroot</Item>
</Array>
</Arg>
</New>
</Set>
<Set name="tempDirectory">/var/cache/scm/work/work/docroot</Set>
</New>
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<Ref id="scm-webapp" />
</Item>
<Item>
<Ref id="docroot" />
</Item>
</Array>
</Set>
</New>
</Set>
<!-- TODO fix for jetty 9.2.x -->
<!-- request logging -->
<!--
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Arg><SystemProperty name="basedir" default="."/>/var/log/yyyy_mm_dd.request.log</Arg>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
-->
<!-- mod_proxy_ajp or mod_jk -->
<!--
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.ajp.Ajp13SocketConnector">
<Set name="port">8009</Set>
</New>
</Arg>
</Call>
-->
<!-- SSL-Connector -->
<!--
Documentation for the SSL-Connector:
http://wiki.eclipse.org/Jetty/Reference/SSL_Connectors
-->
<!--
Besure SSLv3 protocol is excluded to avoid POODLE vulnerability.
See https://groups.google.com/d/msg/scmmanager/sX_Ydy-wAPA/-Dvs5i7RHtQJ
-->
<!--
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Arg>
<New class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="excludeProtocols">
<Array type="java.lang.String">
<Item>SSLv2Hello</Item>
<Item>SSLv3</Item>
</Array>
</Set>
</New>
</Arg>
<Set name="Port">8181</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="requestHeaderSize">16384</Set>
<Set name="keystore"><SystemProperty name="basedir" default="." />/conf/keystore.jks</Set>
<Set name="password">OBF:xxx</Set>
<Set name="keyPassword">OBF:xxx</Set>
<Set name="truststore"><SystemProperty name="basedir" default="." />/conf/keystore.jks</Set>
<Set name="trustPassword">OBF:xxx</Set>
</New>
</Arg>
</Call>
-->
<!-- JMX support -->
<!--
<Call id="MBeanServer" class="java.lang.management.ManagementFactory"
name="getPlatformMBeanServer" />
<New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
<Arg>
<Ref id="MBeanServer" />
</Arg>
</New>
<Get id="Container" name="container">
<Call name="addEventListener">
<Arg>
<Ref id="MBeanContainer" />
</Arg>
</Call>
</Get>
-->
</Configure>

View File

@@ -0,0 +1,16 @@
[Unit]
Description=SCM-Manager Server
After=syslog.target network.target
[Service]
Type=forking
User=scm
Group=scm
WorkingDirectory=/opt/scm-server
ExecStart=/opt/scm-server/bin/scm-server start
ExecStop=/opt/scm-server/bin/scm-server stop
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,192 @@
#!/bin/bash
# ----------------------------------------------------------------------------
# Copyright 2001-2006 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------
# Copyright (c) 2001-2002 The Apache Software Foundation. All rights
# reserved.
# user used to run the daemon (defaults to current user)
USER="scm"
# extra jvm arguments
EXTRA_JVM_ARGUMENTS="-Djava.awt.headless=true -Dlogback.configurationFile=logging.xml"
BASEDIR="/opt/scm-server"
# set pid path for jsvc
PIDFILE="/var/run/scm-server.pid"
# set log dir for jsvc
LOGDIR="/var/log/scm"
# load settings from defaults directory
[ -r /etc/default/scm-server ] && . /etc/default/scm-server
OS=`uname | tr '[:upper:]' '[:lower:]'`
ARCH=`uname -m`
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
case "$OS" in
sunos*) OS="solaris"
ARCH=`uname -p`
;;
cygwin*) cygwin=true ;;
darwin*) darwin=true
if [ -z "$JAVA_VERSION" ] ; then
JAVA_VERSION="CurrentJDK"
else
echo "Using Java version: $JAVA_VERSION"
fi
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# If a specific java binary isn't specified search for the standard 'java' binary
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=`which java`
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " We cannot execute $JAVACMD"
exit 1
fi
if [ -z "$REPO" ]
then
REPO="$BASEDIR"/lib
fi
CLASSPATH=$CLASSPATH_PREFIX:"$BASEDIR"/conf:"$REPO"/scm-server-2.0.0-SNAPSHOT.jar:"$REPO"/commons-daemon-1.2.2.jar:"$REPO"/jetty-server-9.4.27.v20200227.jar:"$REPO"/javax.servlet-api-3.1.0.jar:"$REPO"/jetty-http-9.4.27.v20200227.jar:"$REPO"/jetty-io-9.4.27.v20200227.jar:"$REPO"/jetty-webapp-9.4.27.v20200227.jar:"$REPO"/jetty-xml-9.4.27.v20200227.jar:"$REPO"/jetty-servlet-9.4.27.v20200227.jar:"$REPO"/jetty-security-9.4.27.v20200227.jar:"$REPO"/jetty-jmx-9.4.27.v20200227.jar:"$REPO"/jetty-util-9.4.27.v20200227.jar
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$HOME" ] && HOME=`cygpath --path --windows "$HOME"`
[ -n "$BASEDIR" ] && BASEDIR=`cygpath --path --windows "$BASEDIR"`
[ -n "$REPO" ] && REPO=`cygpath --path --windows "$REPO"`
fi
jsvc=false;
stop="";
if [ "$1" == "start" ]
then
jsvc=true;
else
if [ "$1" == "stop" ]
then
jsvc=true;
stop='-stop';
fi
fi
USER_ARGUMENT=""
if [ "x$USER" != "x" ]
then
USER_ARGUMENT="-user $USER"
fi
DARWIN_USE_ARCH="false"
if $jsvc; then
JSVCCMD=""
if [ "$OS" == "darwin" ]; then
if [ "$DARWIN_USE_ARCH" == "true" ]; then
JSVCCMD="/usr/bin/arch -arch $ARCH $BASEDIR/libexec/jsvc-$OS"
else
JSVCCMD="exec $BASEDIR/libexec/jsvc-$OS"
fi
else
JSVCCMD="exec $BASEDIR/libexec/jsvc-$OS-$ARCH"
fi
# try to extract JAVA_HOME from JAVACMD
if [ -z "$JAVA_HOME" ] ; then
PRG="$JAVACMD"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
DIR="$(dirname "$PRG")"
DIR="$(dirname "$DIR")"
if [ -d "$DIR" ] ; then
JAVA_HOME="$DIR"
fi
fi
# TODO JVM Arguments
$JSVCCMD -cp "$CLASSPATH" $JAVA_OPTS \
$EXTRA_JVM_ARGUMENTS $USER_ARGUMENT \
-outfile "$LOGDIR/scm-server.out" \
-errfile "$LOGDIR/scm-server.err" \
-pidfile "$PIDFILE" \
-jvm server \
-home "$JAVA_HOME" \
-Dapp.name="scm-server" \
-Dapp.pid="$$" \
-Dapp.repo="$REPO" \
-Dbasedir="$BASEDIR" \
$stop sonia.scm.server.ScmServerDaemon \
"$@"
else
exec "$JAVACMD" $JAVA_OPTS \
$EXTRA_JVM_ARGUMENTS \
-classpath "$CLASSPATH" \
-Dapp.name="scm-server" \
-Dapp.pid="$$" \
-Dapp.repo="$REPO" \
-Dbasedir="$BASEDIR" \
sonia.scm.server.ScmServerDaemon \
"$@"
fi

View File

@@ -0,0 +1,35 @@
<!--
MIT License
Copyright (c) 2020-present Cloudogu GmbH and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SCM-Server</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="0;url=/scm">
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,39 @@
#!/bin/sh
#
# MIT License
#
# Copyright (c) 2020-present Cloudogu GmbH and Contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# clear workdir after upgrade
# https://bitbucket.org/sdorra/scm-manager/issues/923/scmmanager-installed-from-debian-package
WORKDIR="/var/cache/scm/work/webapp"
if [ -d "${WORKDIR}" ]; then
rm -rf "${WORKDIR}"
fi
# reload systemd and make service available
systemctl daemon-reload
# enable and start the service
sudo systemctl enable scm-server
sudo systemctl start scm-server

View File

@@ -0,0 +1,31 @@
#!/bin/sh
#
# MIT License
#
# Copyright (c) 2020-present Cloudogu GmbH and Contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
getent group scm >/dev/null || groupadd -r scm
getent passwd scm >/dev/null || \
useradd -r -g scm -M \
-s /sbin/nologin -d /var/lib/scm \
-c "user for the scm-server process" scm
exit 0

View File

@@ -99,6 +99,7 @@
<module>scm-dao-xml</module>
<module>scm-webapp</module>
<module>scm-server</module>
<module>packaging</module>
<module>scm-it</module>
</modules>
@@ -658,6 +659,7 @@
<excludes>
<exclude>.editorconfig</exclude>
<exclude>.git/**</exclude>
<exclude>.*/**</exclude>
<exclude>.mvn/wrapper/**</exclude>
<exclude>docs/**</exclude>
<exclude>node_modules/**</exclude>