configure.xml

72 lines | 3.106 kB Blame History Raw Download
<project name="keycloak-server-configuration" basedir="." >

    <target name="check-configuration-state">
        <available property="configured" file="${project.build.directory}/configured"/>
        <available property="management.configured" file="${project.build.directory}/management-configured"/>
        <echo>configured: ${configured}</echo>
        <echo>management.configured: ${management.configured}</echo>
    </target>       
    
    <target name="configure-modcluster" unless="configured" depends="check-configuration-state">
        <chmod perm="ug+x">
            <fileset dir="${server.unpacked.home}/bin">
                <include name="*.sh"/>
            </fileset>
        </chmod>
        <copy todir="${server.unpacked.home}/bin" >
            <fileset dir="${scripts.dir}/jboss-cli"/>
        </copy>
        <exec executable="./${jboss.cli.script}" dir="${server.unpacked.home}/bin" failonerror="true">
            <arg value="--file=mod-cluster-balancer.cli"/>
        </exec>
        <exec executable="./${jboss.cli.script}" dir="${server.unpacked.home}/bin" failonerror="true">
            <arg value="--file=undertow.cli"/>
        </exec>
        <exec executable="./${jboss.cli.script}" dir="${server.unpacked.home}/bin" failonerror="true">
            <arg value="--file=io-worker-threads.cli"/>
        </exec>
        <delete dir="${server.unpacked.home}/standalone/configuration/standalone_xml_history"/>
        <delete dir="${server.unpacked.home}/standalone/log"/>
        <delete dir="${server.unpacked.home}/standalone/data"/>
        <delete dir="${server.unpacked.home}/standalone/tmp"/>
        <replace file="${server.unpacked.home}/bin/standalone.sh">
            <replacetoken><![CDATA[JBOSS_PID=$!]]></replacetoken>
            <replacevalue><![CDATA[JBOSS_PID=$!

      if [ "$JSTAT" = "true" ] ; then 
        echo "Starting jstat"
        mkdir -p $JBOSS_LOG_DIR
        jstat -gc -t $JBOSS_PID 1000 > $JBOSS_LOG_DIR/jstat-gc.log &
      fi
]]></replacevalue>
        </replace>
        <touch file="${project.build.directory}/configured"/>
    </target>

    <target name="add-management-user" unless="management.configured" depends="check-configuration-state">
        <echo>Adding management user: `${management.user}`</echo>
        <exec executable="./${add.user.script}" dir="${server.unpacked.home}/bin" failonerror="true">
            <arg value="-u"/>
            <arg value="${management.user}"/>
            <arg value="-p"/>
            <arg value="${management.user.password}"/>
        </exec>
        <touch file="${project.build.directory}/management-configured"/>
    </target>
    
    <target name="prepare-docker-config">
        <copy todir="${project.build.directory}/docker" overwrite="false">
            <fileset dir="${scripts.dir}">
                <include name="Dockerfile"/>
                <include name="*.sh"/>
            </fileset>
        </copy>
        <copy todir="${project.build.directory}/docker/wildfly" overwrite="false">
            <fileset dir="${server.unpacked.home}">
                <exclude name="bin/*.cli"/>
            </fileset>
        </copy>
    </target>

</project>