ラベル OpenShift の投稿を表示しています。 すべての投稿を表示
ラベル OpenShift の投稿を表示しています。 すべての投稿を表示

2013年2月10日日曜日

「Deploying GateIn to OpenShift」の間違い点


OpenShiftのJBossにGateInをデプロイして実行させた結果、起動できず。
で、調べてみた処、standalone.xmlの設定が間違っていたので、修正して、なんとか起動できた。
その報告を書いておく。
[参考ページ]
Deploying GateIn to OpenShift
https://community.jboss.org/wiki/DeployingGateInToOpenShift

間違っていた箇所は3箇所。
間違っていた箇所は4箇所。(20130520)
1つ目は、環境変数の指定。
2つ目は、TCPPINGのinitial_hostsプロパティの指定。
3つ目は、AUTHのauth_valueプロパティの指定。
4つ目は、.openshift/config/modules/org/jboss/as/webの作成とモジュールのコピー。(20130520)

1.環境変数の指定
参考ページによると、「standalone.xmlをダウンロードして、修正しろ」ってことだった。
で、そのstandalone.xmlは現状、こんな内容。
<system-properties>
 <property name="exo.conf.dir" value="/var/lib/stickshift/${USER_ID}/${APP_NAME}/jbossas-7/standalone/configuration/gatein" />
 <property name="gatein.conf.dir" value="/var/lib/stickshift/${USER_ID}/${APP_NAME}/jbossas-7/standalone/configuration/gatein" />
 <property name="exo.conf.dir.name" value="gatein" />
</system-properties>
この${USER_ID}を自分にユーザ名に変更しろってのはOK。
だが${APP_NAME}を"portal"に変更しろってのは間違い。
本当は"jbossas-7"に変更しなければいけない。
あと、パスの一部にある"stickshift"も間違いで、本当は"openshift"に変更しなければいけない。
よって、正しい内容は下記になる。
<system-properties>
 <property name="exo.conf.dir" value="/var/lib/openshift/ユーザー名/jbossas-7/jbossas-7/standalone/configuration/gatein" />
 <property name="gatein.conf.dir" value="/var/lib/openshift/ユーザー名/jbossas-7/jbossas-7/standalone/configuration/gatein" />
 <property name="exo.conf.dir.name" value="gatein" />
</system-properties>
(20130520)環境変数を使用した設定に変更。
<system-properties>
 <property name="exo.conf.dir" value="${env.JBOSS_HOME}/standalone/configuration/gatein" />
 <property name="gatein.conf.dir" value="${env.JBOSS_HOME}/standalone/configuration/gatein" />
 <property name="exo.conf.dir.name" value="gatein" />
</system-properties>


2.TCPPINGのinitial_hostsプロパティの指定。
ダウンロードしたstandalone.xmlは現状、こんな内容。
<protocol type="TCPPING">
<property name="timeout">3000</property>
<property name="initial_hosts">${env.OPENSHIFT_JBOSS_CLUSTER}</property>
<property name="port_range">0</property>
<property name="num_initial_members">1</property>
</protocol>
この${env.OPENSHIFT_JBOSS_CLUSTER}は間違いで、正しくは${env.OPENSHIFT_JBOSSAS_CLUSTER}。
よって、正しい内容は下記になる。
<protocol type="TCPPING">
 <property name="timeout">3000</property>
 <property name="initial_hosts">${env.OPENSHIFT_JBOSSAS_CLUSTER}</property>
 <property name="port_range">0</property>
 <property name="num_initial_members">1</property>
</protocol>

3.AUTHのauth_valueプロパティの指定
これも上記同様${env.OPENSHIFT_JBOSS_CLUSTER}は間違いで、正しくは${env.OPENSHIFT_JBOSSAS_CLUSTER}。
よって、正しい内容は下記になる。
<protocol type="AUTH">
 <property name="auth_class">org.jgroups.auth.MD5Token</property>
 <property name="token_hash">SHA</property>
 <property name="auth_value">${env.OPENSHIFT_JBOSSAS_CLUSTER}</property>
</protocol>

4..openshift/config/modules/org/jboss/as/webの作成とモジュールのコピー。
説明ページでは、
We also have to override org.jboss.as.web module, by adding a dependency into its modules.xml file. We just copy the whole patched-up module:
mkdir -p .openshift/config/modules/org/jboss/as/web
cp -r ../GateIn-3.2.0.Final-jbossas7-preview/modules/org/jboss/as/web .openshift/config/modules/org/jboss/as
とあるが、これは現在のOpenShiftバージョンでは不要

というか禁止
これやると起動できない。

その他にも、${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}など、修正が必要になる箇所が多数あるようす。
何せ、古いstandalone.xmlを使ってるもんだからね。

(20130520)今回使用したstandalone.xml
OpenShiftのデフォルトxmlに、GateInの設定を追加(したつもり)。
[standalone.xml]
<?xml version='1.0' encoding='UTF-8'?>

<server xmlns="urn:jboss:domain:1.1">

<extensions>
<extension module="org.jboss.as.clustering.infinispan" />
<extension module="org.jboss.as.clustering.jgroups" />
<extension module="org.jboss.as.cmp" />
<extension module="org.jboss.as.configadmin" />
<extension module="org.jboss.as.connector" />
<extension module="org.jboss.as.deployment-scanner" />
<extension module="org.jboss.as.ee" />
<extension module="org.jboss.as.ejb3" />
<extension module="org.jboss.as.jacorb" />
<extension module="org.jboss.as.jaxr" />
<extension module="org.jboss.as.jaxrs" />
<extension module="org.jboss.as.jdr" />
<extension module="org.jboss.as.jmx" />
<extension module="org.jboss.as.jpa" />
<extension module="org.jboss.as.jsr77" />
<extension module="org.jboss.as.logging" />
<extension module="org.jboss.as.mail" />
<extension module="org.jboss.as.messaging" />
<extension module="org.jboss.as.naming" />
<extension module="org.jboss.as.osgi" />
<extension module="org.jboss.as.pojo" />
<extension module="org.jboss.as.remoting" />
<extension module="org.jboss.as.sar" />
<extension module="org.jboss.as.security" />
<extension module="org.jboss.as.threads" />
<extension module="org.jboss.as.transactions" />
<extension module="org.jboss.as.web" />
<extension module="org.jboss.as.webservices" />
<extension module="org.jboss.as.weld" />
<extension module="org.gatein" />
</extensions>

<system-properties>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION"
value="on" />
<property name="exo.conf.dir"
value="${env.JBOSS_HOME}/standalone/configuration/gatein" />
<property name="gatein.conf.dir"
value="${env.JBOSS_HOME}/standalone/configuration/gatein" />
<property name="exo.conf.dir.name" value="gatein" />
</system-properties>

<management>
<management-interfaces>
<native-interface>
<socket-binding native="management-native" />
</native-interface>
<http-interface>
<socket-binding http="management-http" />
</http-interface>
</management-interfaces>
</management>

<profile>
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<!--console-handler name="CONSOLE"> <level name="INFO"/> <formatter> <pattern-formatter
pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter> </console-handler -->
<periodic-rotating-file-handler name="FILE">
<formatter>
<pattern-formatter
pattern="%d{yyyy/MM/dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n" />
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log" />
<suffix value=".yyyy-MM-dd" />
<append value="true" />
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN" />
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN" />
</logger>
<logger category="sun.rmi">
<level name="WARN" />
</logger>
<logger category="jacorb">
<level name="WARN" />
</logger>
<logger category="jacorb.config">
<level name="ERROR" />
</logger>
<root-logger>
<level name="INFO" />
<handlers>
<!--handler name="CONSOLE"/ -->
<handler name="FILE" />
</handlers>
</root-logger>
</subsystem>
<subsystem xmlns="urn:jboss:domain:cmp:1.0" />
<subsystem xmlns="urn:jboss:domain:configadmin:1.0" />
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS"
enabled="true" use-java-context="true" pool-name="H2DS">
<connection-url>jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1
</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/MysqlDS"
enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS"
use-ccm="true">
<connection-url>jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}
</connection-url>
<driver>mysql</driver>
<security>
<user-name>${env.OPENSHIFT_MYSQL_DB_USERNAME}</user-name>
<password>${env.OPENSHIFT_MYSQL_DB_PASSWORD}</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<background-validation>true</background-validation>
</validation>
<pool>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
</datasource>
<datasource jndi-name="java:jboss/datasources/PostgreSQLDS"
enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS"
use-ccm="true">
<connection-url>jdbc:postgresql://${env.OPENSHIFT_POSTGRESQL_DB_HOST}:${env.OPENSHIFT_POSTGRESQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}
</connection-url>
<driver>postgresql</driver>
<security>
<user-name>${env.OPENSHIFT_POSTGRESQL_DB_USERNAME}</user-name>
<password>${env.OPENSHIFT_POSTGRESQL_DB_PASSWORD}</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<background-validation>true</background-validation>
</validation>
<pool>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource
</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql.jdbc">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
</driver>
<driver name="postgresql" module="org.postgresql.jdbc">
<xa-datasource-class>org.postgresql.xa.PGXADataSource
</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
<deployment-scanner path="deployments"
relative-to="jboss.server.base.dir" scan-interval="5000"
deployment-timeout="300" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee:1.0" />
<subsystem xmlns="urn:jboss:domain:ejb3:1.2">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool" />
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple"
clustered-cache-ref="clustered" />
<singleton default-access-timeout="5000" />
</session-bean>
<mdb>
<resource-adapter-ref resource-adapter-name="hornetq-ra" />
<bean-instance-pool-ref pool-name="mdb-strict-max-pool" />
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool"
max-pool-size="20" instance-acquisition-timeout="5"
instance-acquisition-timeout-unit="MINUTES" />
<strict-max-pool name="mdb-strict-max-pool"
max-pool-size="20" instance-acquisition-timeout="5"
instance-acquisition-timeout-unit="MINUTES" />
</bean-instance-pools>
</pools>
<caches>
<cache name="simple" aliases="NoPassivationCache" />
<cache name="passivating" passivation-store-ref="file"
aliases="SimpleStatefulCache" />
<cache name="clustered" passivation-store-ref="infinispan"
aliases="StatefulTreeCache" />
</caches>
<passivation-stores>
<file-passivation-store name="file" />
<cluster-passivation-store name="infinispan"
cache-container="ejb" />
</passivation-stores>
<async thread-pool-name="default" />
<timer-service thread-pool-name="default">
<data-store path="timer-service-data" relative-to="jboss.server.data.dir" />
</timer-service>
<remote connector-ref="remoting-connector" thread-pool-name="default" />
<thread-pools>
<thread-pool name="default">
<max-threads count="10" />
<keepalive-time time="100" unit="milliseconds" />
</thread-pool>
</thread-pools>
<!--iiop enable-by-default="false" use-qualified-name="false"/ -->
</subsystem>
<subsystem xmlns="urn:jboss:domain:infinispan:1.1"
default-cache-container="cluster">
<cache-container name="cluster" aliases="ha-partition"
default-cache="default">
<transport lock-timeout="60000" />
<replicated-cache name="default" mode="SYNC"
batching="true">
<locking isolation="REPEATABLE_READ" />
</replicated-cache>
</cache-container>
<cache-container name="web" aliases="standard-session-cache"
default-cache="repl">
<transport lock-timeout="60000" />
<replicated-cache name="repl" mode="ASYNC"
batching="true">
<file-store />
</replicated-cache>
<replicated-cache name="sso" mode="SYNC" batching="true" />
<distributed-cache name="dist" mode="ASYNC"
batching="true">
<file-store />
</distributed-cache>
</cache-container>
<cache-container name="ejb" aliases="sfsb sfsb-cache"
default-cache="repl">
<transport lock-timeout="60000" />
<replicated-cache name="repl" mode="ASYNC"
batching="true">
<eviction strategy="LRU" />
<file-store />
</replicated-cache>
<!-- Clustered cache used internally by EJB subsytem for managing the
client-mapping(s) of the socketbinding referenced by the EJB remoting connector -->
<replicated-cache name="remote-connector-client-mappings"
mode="SYNC" batching="true" />
<distributed-cache name="dist" mode="ASYNC"
batching="true">
<eviction strategy="LRU" />
<file-store />
</distributed-cache>
</cache-container>
<cache-container name="hibernate" default-cache="local-query">
<transport lock-timeout="60000" />
<local-cache name="local-query">
<transaction mode="NONE" />
<eviction strategy="LRU" max-entries="10000" />
<expiration max-idle="100000" />
</local-cache>
<invalidation-cache name="entity" mode="SYNC">
<transaction mode="NON_XA" />
<eviction strategy="LRU" max-entries="10000" />
<expiration max-idle="100000" />
</invalidation-cache>
<replicated-cache name="timestamps" mode="ASYNC">
<transaction mode="NONE" />
<eviction strategy="NONE" />
</replicated-cache>
</cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jacorb:1.1">
<orb>
<initializers transactions="spec" security="on" />
</orb>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxr:1.0">
<connection-factory jndi-name="java:jboss/jaxr/ConnectionFactory" />
<juddi-server publish-url="http://${env.OPENSHIFT_JBOSSAS_IP}:8080/juddi/publish"
query-url="http://${env.OPENSHIFT_JBOSSAS_IP}:8080/juddi/query" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0" />
<subsystem xmlns="urn:jboss:domain:jca:1.1">
<archive-validation enabled="true" fail-on-error="true"
fail-on-warn="false" />
<bean-validation enabled="false" />
<default-workmanager>
<short-running-threads>
<core-threads count="10" />
<queue-length count="10" />
<max-threads count="10" />
<keepalive-time time="10" unit="seconds" />
</short-running-threads>
<long-running-threads>
<core-threads count="10" />
<queue-length count="10" />
<max-threads count="10" />
<keepalive-time time="10" unit="seconds" />
</long-running-threads>
</default-workmanager>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jdr:1.0" />
<subsystem xmlns="urn:jboss:domain:jgroups:1.0"
default-stack="tcp">
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp">
<property name="external_addr">${env.OPENSHIFT_GEAR_DNS}</property>
<property name="external_port">${env.OPENSHIFT_JBOSSAS_CLUSTER_PROXY_PORT}
</property>
<property name="bind_port">7600</property>
<property name="bind_addr">${env.OPENSHIFT_JBOSSAS_IP}</property>
<property name="defer_client_bind_addr">true</property>
</transport>
<protocol type="TCPPING">
<property name="timeout">30000</property>
<property name="initial_hosts">${env.OPENSHIFT_JBOSSAS_CLUSTER}</property>
<property name="port_range">0</property>
<property name="num_initial_members">1</property>
</protocol>
<protocol type="MERGE2" />
<protocol type="FD" />
<protocol type="VERIFY_SUSPECT" />
<protocol type="BARRIER" />
<protocol type="pbcast.NAKACK" />
<protocol type="UNICAST2" />
<protocol type="pbcast.STABLE" />
<protocol type="AUTH">
<property name="auth_class">org.jgroups.auth.MD5Token</property>
<property name="token_hash">SHA</property>
<property name="auth_value">${env.OPENSHIFT_APP_UUID}</property>
</protocol>
<protocol type="pbcast.GMS" />
<protocol type="UFC" />
<protocol type="MFC" />
<protocol type="FRAG2" />
<!--protocol type="pbcast.STATE_TRANSFER"/> <protocol type="pbcast.FLUSH"/ -->
</stack>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jmx:1.1">
<show-model value="true" />
<remoting-connector />
</subsystem>
<subsystem xmlns="urn:jboss:domain:jpa:1.0">
<jpa default-datasource="" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:jsr77:1.0" />
<subsystem xmlns="urn:jboss:domain:mail:1.0">
<mail-session jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp" />
</mail-session>
</subsystem>
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
<clustered>true</clustered>
<persistence-enabled>true</persistence-enabled>
<!--security-domain>messaging</security-domain -->
<security-enabled>false</security-enabled>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>

<thread-pool-max-size>${messaging.thread.pool.max.size}
</thread-pool-max-size>
<scheduled-thread-pool-max-size>${messaging.scheduled.thread.pool.max.size}
</scheduled-thread-pool-max-size>

<connectors>
<netty-connector name="netty" socket-binding="messaging" />
<netty-connector name="netty-throughput"
socket-binding="messaging-throughput">
<param key="batch-delay" value="50" />
</netty-connector>
<in-vm-connector name="in-vm" server-id="0" />
</connectors>

<acceptors>
<netty-acceptor name="netty" socket-binding="messaging" />
<netty-acceptor name="netty-throughput"
socket-binding="messaging-throughput">
<param key="batch-delay" value="50" />
<param key="direct-deliver" value="false" />
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0" />
</acceptors>

<!--broadcast-groups> <broadcast-group name="bg-group1"> <group-address>231.7.7.7</group-address>
<group-port>9876</group-port> <broadcast-period>5000</broadcast-period> <connector-ref>
netty </connector-ref> </broadcast-group> </broadcast-groups> <discovery-groups>
<discovery-group name="dg-group1"> <group-address>231.7.7.7</group-address>
<group-port>9876</group-port> <refresh-timeout>10000</refresh-timeout> </discovery-group>
</discovery-groups> <cluster-connections> <cluster-connection name="my-cluster">
<address>jms</address> <connector-ref>netty</connector-ref> <discovery-group-ref
discovery-group-name="dg-group1"/> </cluster-connection> </cluster-connections -->

<!--security-settings> <security-setting match="#"> <permission type="send"
roles="guest"/> <permission type="consume" roles="guest"/> <permission type="createNonDurableQueue"
roles="guest"/> <permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting> </security-settings -->

<address-settings>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<address-full-policy>BLOCK</address-full-policy>
<message-counter-history-day-limit>10
</message-counter-history-day-limit>
<redistribution-delay>1000</redistribution-delay>
</address-setting>
</address-settings>

<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm" />
</connectors>
<entries>
<entry name="java:/ConnectionFactory" />
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty" />
</connectors>
<entries>
<entry name="RemoteConnectionFactory" />
<entry name="java:jboss/exported/jms/RemoteConnectionFactory" />
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa" />
<connectors>
<connector-ref connector-name="in-vm" />
</connectors>
<entries>
<entry name="java:/JmsXA" />
</entries>
</pooled-connection-factory>
</jms-connection-factories>

<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test" />
<entry name="java:jboss/exported/jms/queue/test" />
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test" />
<entry name="java:jboss/exported/jms/topic/test" />
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:1.1" />
<subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy">
<properties>
<!-- Specifies the beginning start level of the framework -->
<property name="org.osgi.framework.startlevel.beginning">1</property>
</properties>
<capabilities>
<!-- modules registered with the OSGi layer on startup -->
<capability name="javax.servlet.api:v25" />
<capability name="javax.transaction.api" />
<!-- bundles started in startlevel 1 -->
<capability name="org.apache.felix.log" startlevel="1" />
<capability name="org.jboss.osgi.logging" startlevel="1" />
<capability name="org.apache.felix.configadmin"
startlevel="1" />
<capability name="org.jboss.as.osgi.configadmin"
startlevel="1" />
</capabilities>
</subsystem>
<subsystem xmlns="urn:jboss:domain:pojo:1.0" />
<subsystem xmlns="urn:jboss:domain:remoting:1.1">
<connector name="remoting-connector" socket-binding="remoting" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0" />
<subsystem xmlns="urn:jboss:domain:sar:1.0" />
<subsystem xmlns="urn:jboss:domain:security:1.1">
<security-domains>
<security-domain name="other" cache-type="default">
<authentication>
<login-module code="UsersRoles" flag="required" />
</authentication>
</security-domain>
<security-domain name="jboss-web-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required" />
</authorization>
</security-domain>
<security-domain name="jboss-ejb-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required" />
</authorization>
</security-domain>
<security-domain name="messaging" cache-type="default">
<authentication>
<login-module code="UsersRoles" flag="required">
<module-option name="usersProperties"
value="${jboss.server.config.dir}/application-users.properties" />
<module-option name="rolesProperties"
value="${jboss.server.config.dir}/application-roles.properties" />
</login-module>
</authentication>
</security-domain>
<security-domain name="gatein-domain" cache-type="default">
<authentication>
<login-module code="org.gatein.wci.security.WCILoginModule"
flag="optional">
<module-option name="portalContainerName" value="portal" />
<module-option name="realmName" value="gatein-domain" />
</login-module>
<login-module
code="org.exoplatform.services.security.jaas.SharedStateLoginModule"
flag="required">
<module-option name="portalContainerName" value="portal" />
<module-option name="realmName" value="gatein-domain" />
</login-module>
<login-module
code="org.exoplatform.services.security.j2ee.JbossLoginModule"
flag="required">
<module-option name="portalContainerName" value="portal" />
<module-option name="realmName" value="gatein-domain" />
</login-module>
</authentication>
</security-domain>
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.1" />
<subsystem xmlns="urn:jboss:domain:transactions:1.1">
<core-environment>
<process-id>
<uuid />
</process-id>
</core-environment>
<recovery-environment socket-binding="txn-recovery-environment"
status-socket-binding="txn-status-manager" />
<coordinator-environment default-timeout="300" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:web:1.1"
default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http"
socket-binding="http" />
<virtual-server name="default-host"
enable-welcome-root="false">
<alias name="localhost" />
</virtual-server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:webservices:1.1">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${env.OPENSHIFT_GEAR_DNS}</wsdl-host>
<wsdl-port>80</wsdl-port>
<endpoint-config name="Standard-Endpoint-Config" />
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers"
protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler"
class="org.jboss.ws.common.invocation.RecordingServerHandler" />
</pre-handler-chain>
</endpoint-config>
</subsystem>
<subsystem xmlns="urn:jboss:domain:weld:1.0" />
<subsystem xmlns="urn:jboss:domain:gatein:1.0">
<deployment-archives>
<archive name="gatein.ear" main="true" />
</deployment-archives>
</subsystem>
</profile>

<interfaces>
<interface name="management">
<loopback-address value="${env.OPENSHIFT_JBOSSAS_IP}" />
</interface>
<interface name="public">
<loopback-address value="${env.OPENSHIFT_JBOSSAS_IP}" />
</interface>
<interface name="unsecure">
<!-- Used for IIOP sockets in the standarad configuration. To secure JacORB
you need to setup SSL -->
<loopback-address value="${env.OPENSHIFT_JBOSSAS_IP}" />
</interface>
</interfaces>

<socket-binding-group name="standard-sockets"
default-interface="public" port-offset="0">
<socket-binding name="http" port="8080" />
<socket-binding name="jacorb" interface="unsecure"
port="3528" />
<socket-binding name="jacorb-ssl" interface="unsecure"
port="3529" />
<socket-binding name="jgroups-tcp" port="7600" />
<socket-binding name="management-native" interface="management"
port="9999" />
<socket-binding name="management-http" interface="management"
port="9990" />
<socket-binding name="messaging" port="5445" />
<socket-binding name="messaging-throughput" port="5455" />
<socket-binding name="osgi-http" interface="management"
port="8090" />
<socket-binding name="remoting" port="4447" />
<socket-binding name="txn-recovery-environment" port="4712" />
<socket-binding name="txn-status-manager" port="4713" />
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25" />
</outbound-socket-binding>
</socket-binding-group>
</server>




2012年12月28日金曜日

OpenShiftのTomcat添付README(作成中)

OpenShiftのTomcatに付いていたREADME。
徐々に翻訳予定。


Repo layout
レポレイアウト
===========
webapps/ - location for built wars (Details below)
webapps/ - 構築されたWARファイルの配置場所(以下詳細)
src/ - Maven src structure
src/ - Mavenのソース構造
pom.xml - Maven build file
pom.xml - Mavenのビルドファイル
.openshift/ - location for openshift specific files
.openshift/ - openshiftの詳細ファイル配置場所
.openshift/config/ - location for configuration files such as standalone.xml (used to modify jboss config such as datasources)
.openshift/config/ - standalone.xmlなど設定ファイル配置場所 (データソースなどJBoss設定に使用)
ん?standalone.xmlなんか無いぞ?server.xmlなどtomcatの設定ファイルだぞ?
.openshift/action_hooks/pre_build - Script that gets run every git push before the build (on the CI system if available)
.openshift/action_hooks/pre_build - git pushビルドの前に実行されるスクリプト(もし有効であればCIシステム上で)
.openshift/action_hooks/build - Script that gets run every git push as part of the build process (on the CI system if available)
.openshift/action_hooks/build - git pushビルドプロセスの一部として実行されるスクリプト(もし有効であればCIシステム上で)
.openshift/action_hooks/deploy - Script that gets run every git push after build but before the app is restarted
.openshift/action_hooks/deploy - git pushビルド後毎に実行されるアプリが再起動される前に実行されるスクリプト
.openshift/action_hooks/post_deploy - Script that gets run every git push after the app is restarted
.openshift/action_hooks/post_deploy - アプリが再起動された後、git push毎に実行されるスクリプト
.openshift/action_hooks/pre_start_jbossews-1.0 - Script that gets run prior to starting EWS1.0
.openshift/action_hooks/pre_start_jbossews-1.0 - EWS1.0を開始する前に実行されるスクリプト
.openshift/action_hooks/post_start_jbossews-1.0 - Script that gets run after EWS1.0 is started
.openshift/action_hooks/post_start_jbossews-1.0 - EWS1.0開始後に実行されるスクリプト
.openshift/action_hooks/pre_stop_jbossews-1.0 - Script that gets run prior to stopping EWS1.0
.openshift/action_hooks/pre_stop_jbossews-1.0 - EWS1.0を停止する前に実行されるスクリプト
.openshift/action_hooks/post_stop_jbossews-1.0 - Script that gets run after EWS1.0 is stopped
.openshift/action_hooks/post_stop_jbossews-1.0 - EWS1.0停止後に実行されるスクリプト


Notes about layout
レイアウトについての注意事項
==================
Note: Every time you push, everything in your remote repo dir gets recreated
      please store long term items (like an sqlite database) in the OpenShift
      data directory, which will persist between pushes of your repo.
注意:あなたがpushをかける度に、あなたのリモート・レポ・ディレクトリ内全ては再作成を受けるので、OpenShiftデータ・ディレクトリには長期アイテム(sqliteデータベースのような)をストアしてください。そこはプッシュの間も持続されます。
      The OpenShift data directory is accessible relative to the remote repo
      directory (../data) or via an environment variable OPENSHIFT_DATA_DIR.
OpenShiftのdataディレクトリは、相対的なリモートレポ(../data)経由、又はOPENSHIFT_DATA_DIR環境変数を経由してアクセス可能です。


Details about layout and deployment options
レイアウトとデプロイメント・オプションの詳細
==================
There are two options for deploying content to the Tomcat Server within OpenShift.
OpenShiftのTomcatサーバーにコンテンツをデプロイするのに2つのオプションがある。 
Both options can be used together (i.e. build one archive from source and others pre-built)
どちらのオプションも一緒に使用される(すなわち、ソースと他のプレ・ビルドから一つのアーカイブがビルドされる)。

1) (Preferred) You can upload your content in a Maven src structure as is this sample project and on git push have the application built and deployed.
1) (好ましい方法)サンプルプロジェクトのようにMavenソース構造のコンテンツをアップロード可能であり、そしてgit pushでアプリケーションをビルドし、デプロイされる。
For this to work you'll need your pom.xml at the root of your repository and a maven-war-plugin like in this sample to move the output from the build to the webapps directory.
これが正常に機能するために、レポジトリルートにpom.xmlが必要で、サンプルのようなmaven-war-pluginがbuildからwebappsディレクトリへ出力するのに必要だろう。
By default the warName is ROOT within pom.xml.
デフォルトのWARファイル名は、pom.xmlの中にあるROOTである。
This will cause the webapp contents to be rendered at http://app_name-amespace.rhcloud.com/.
これはwebappコンテンツがhttp://app_name-amespace.rhcloud.com/で表示されるためである。
If you change the warName in pom.xml to app_name, your base url would then become http://app_name-namespace.rhcloud.com/app_name.
もしpom.xml中のwarNameをapp_nameに変えたなら、ベースURLはhttp://app_name-namespace.rhcloud.com/app_nameとなる。
Note: If you are building locally you'll also want to add any output wars under webapps
from the build to your .gitignore file.
注意:もしローカルでビルドしているのなら、幾つかwebapps下に出力したwarファイルを、ビルドから.gitignoreファイルまで追加を望むでしょう。
Note: If you are running scaled EWS1.0 then you need an application deployed to the root context (i.e. http://app_name-namespace.rhcloud.com/) for the HAProxy load-balancer to recognize that the EWS1.0 instance is active.
注意:もし貴方がスケールされたEWS1.0を実行しているなら、EWS1.0インスタンスがアクティブであることを認識する為に、HAProxyロードバランサーの為に、ルートコンテキストへのアプリケーション配備が必要です。
or
もしくは
2) You can git push pre-built wars into webapps/.
2) webappsフォルダにプレビルドのwarをgit pushすることができる。
To do this with the default repo you'll want to first run 'git rm -r src/ pom.xml' from the root of your repo.
デフォルトのレポでこれを行うには、あなたのレポのルートから'git rm -r src/ pom.xml'を最初に実行しようと望むだろう。
Basic workflows for deploying pre-built content (each operation will require associated git add/commit/push operations to take effect):
ビルド前コンテンツをデプロイするための基本ワークフロー(各オペレーションは有効となるためにgit add/commit/push操作に関連が必要となる):

A) Add new zipped content and deploy it:
A)新規ZIPコンテンツを追加し、それをデプロイする:

1. cp target/example.war webapps/

B) Undeploy currently deployed content:
B)現在デプロイされたコンテンツをアンデプロイする:

1. git rm webapps/example.war

C) Replace currently deployed zipped content with a new version and deploy it:
C)現在デプロイされたZIPコンテンツを新バージョンに置き換え、それをデプロイする:

1. cp target/example.war webapps/

Note: You can get the information in the uri above from running 'rhc domain show'
注意:あなたは'rhc domain show'実行結果のURIの中で、情報を入手可能である。

If you have already committed large files to your git repo, you rewrite or reset the history of those files in git to an earlier point in time and then 'git push --force' to apply those changes on the remote OpenShift server.
あなたがGitレポに、既にコミットされた大きなファイルを有しているのなら、あなたは上書き又はそれらのファイルの履歴をgit以前の時点にリセットし、次に'git push --force'を適用してリモートOpenShiftサーバー上でこれらを変更して欲しい。
A git gc on the remote OpenShift repo can be forced with (Note: tidy also does other cleanup including clearing log files and tmp dirs):
リモートOpenShift上のgit gcは、強制させることもできる(注意:)
rhc app tidy -a appname


Whether you choose option 1) or 2) the end result will be the application
deployed into the webapps directory. The webapps directory in the
Tomcat distribution is the location end users can place
their deployment content (e.g. war, ear, jar, sar files) to have it
automatically deployed into the server runtime.

Environment Variables
=====================

OpenShift provides several environment variables to reference for ease
of use.  The following list are some common variables but far from exhaustive:

    System.getenv("OPENSHIFT_APP_NAME")  - Application name
    System.getenv("OPENSHIFT_DATA_DIR")  - For persistent storage (between pushes)
    System.getenv("OPENSHIFT_TMP_DIR")   - Temp storage (unmodified files deleted after 10 days)
    System.getenv("OPENSHIFT_INTERNAL_IP")  - The IP address used to bind EWS1.0

When embedding a database using 'rhc app cartridge add', you can reference environment
variables for username, host and password. For example, when embedding MySQL 5.1, the
following variables will be available:

    System.getenv("OPENSHIFT_MYSQL_DB_HOST")      - DB host
    System.getenv("OPENSHIFT_MYSQL_DB_PORT")      - DB Port
    System.getenv("OPENSHIFT_MYSQL_DB_USERNAME")  - DB Username
    System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD")  - DB Password

To get a full list of environment variables, simply add a line in your
.openshift/action_hooks/build script that says "export" and push.

2012年6月21日木曜日

OpenShiftのLinuxで使えるコマンド

ココに、OpenShiftにSSHログインした後で使用可能なコマンドリストがあったので書いておく。
Remotely Accessing your App with SSH
https://openshift.redhat.com/community/developers/remote-access
ほとんどがLinuxを使ったことがあれば誰でも知ってるコマンドだけどね。

Common Commands

help
Displays a list of common commands to use

ctl_app
control your application

ctl_app start
ctl_app stop
ctl_app restart
ctl_app status

ctl_all
Similar to ctl_app but controlls application and deps like mysql in one command

ctl_all start
ctl_all stop
ctl_all restart
ctl_all status

export
Prints out all available environment variables and their current values which you may use in your application

rm
Removes a file or directory

Use this with care

Remove a file:

rm file

Remove a directory and all files and directories under it

rm -rf

tail_all
Displays the last entries in your log files as they are written to

You can hit ctrl-c to exit this command

ls
List files and directories

ps
List running applications

kill
Kill running applications using the process id found by calling ps

Be careful when using this command as it should only be used to kill runaway processes, otherwise it is preferable to stop them using the appropriate command such as ctl_app stop

mysql
Opens an interactive MySQL shell

mongo
Opens an interactive MongoDB shell

quota
Lists your application's current disk usage

2012年6月19日火曜日

OpenShiftDIYのTomcat7用server.xml

OpenShiftにDIYアプリケーションを作成し、その中にTomcat7を作ってみた。
その際に設定のキモだったのがTomcatのserver.xmlだったので、その中身を書いておく。

Liferayや他のアプリケーションサーバでもTomcat7なら、このserver.xmlでいけるかもしれない。
でもLiferayはデプロイ設定を変えないとNGだろうな…、OpenShiftはホームディレクトリに書き込み権限が無いからね。
っと思い、試しにOpenShiftDIYにLiferayをセットアップし、走らせた結果…
起動中に「Killed」が出てきてダウンした。
たぶんメモリ不足か何か使用可能リソース制限に触れたのだと思う。
ならばJetspeed2でどうよ、っと思いJetspeed2を試した結果…
Jetspeed2も起動中に「Killed」でダウン。
主要ポートレットコンテナ2つが使用不可なのが残念。
Pluto2.0は動作可能だから、とりあえずはPluto2.0でいいや。

ココの料金ページによると、無料で使えるFreeは、Gear SizesはSmallがデフォルト。
このSmallだとメモリ容量は512 MB RAMだそうな。Mediumだと1 GB RAMだそうな。
Pricing

ココのコミュニティフォーラム記事によると、デフォルトはスモールサイズらしい。
ミディアムサイズにしたければopenshift@redhat.comにメールを送れってことだった。
Cannot deploy Liferay because of PermGen

20120927 Liferayのクイックスタートがあるので、Liferayを作れるかもしれない
openshift / jbossas7-liferay-quickstart

で、本題に戻って…
DIYの中にTomcatを作る方法は、ココ。
Free Apache Tomcat Hosting in the Cloud for Java Applications? It's Called OpenShift!
https://openshift.redhat.com/community/blogs/free-apache-tomcat-hosting-in-the-cloud-for-java-applications-its-called-openshift

20120918 どうやらshutdown設定とajp設定にIPアドレスを入れないと動かないようになったみたいなので、設定追加

で、今回は各設定を下記のようにした前提。
URL = tomcat-yourdomain.rhcloud.com
OPENSHIFT_INTERNAL_IP = 127.6.99.1

[server.xml]

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="15005" shutdown="SHUTDOWN" address="127.6.99.1" >
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               address="127.6.99.1"
               redirectPort="15443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="15009" protocol="AJP/1.3" redirectPort="8443" address="127.6.99.1" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="127.6.99.1">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="tomcat-yourdomain.rhcloud.com"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

2012年6月16日土曜日

OpenShiftDIYの作り方


Started with DIY Applications on OpenShift
https://openshift.redhat.com/community/blogs/a-paas-that-runs-anything-http-getting-started-with-diy-applications-on-openshift
とりあえず機械翻訳そのまんま、徐々に直すかな。

In addition to supporting Perl, Ruby, PHP, Python, and Java EE6, the OpenShift environment supports the "Do it Yourself" or "DIY" application type.
PerlやRuby、PHP、Python、及びJava EE6のサポートに加え、OpenShift環境をサポートするのが、"DIY" または"Do it Yourself"アプリケーションタイプです。
Using this application type, you can run just about any program that speaks HTTP.
このアプリケーション·タイプを使用して、HTTPを話すすべてのプログラムについてだけ実行することができます。

How this works is remarkably straightforward.
これがどのように動作するかは、とても直接的です。
The OpenShift execution environment is a carefully secured Red Hat Enterprise Linux 6.2 on x64 systems.
OpenShift実行環境は、x64システム上で慎重に確保されたRed Hat Enterprise Linux6.2です。
Thus, OpenShift can run any binary that will run on RHEL 6.2 x64.
したがって、OpenShiftは、RHEL6.2 x64上で実行される任意のバイナリを実行することができます。

The way that OpenShift DIY interfaces your application to the outside world is that creates a HTTP proxy specified by the environment variables OPENSHIFT_INTERNAL_IP and OPENSHIFT_INTERNAL_PORT.
OpenShift DIY·インタフェース外の世界へは、アプリケーションが環境変数OPENSHIFT_INTERNAL_IPとOPENSHIFT_INTERNAL_PORTで指定されたHTTPプロキシを作成することであることをする方法。
All your application has to do is bind and listen on that address and port.
すべてのアプリケーションは、そのアドレスとポートをバインドしリッスンする必要があります。
HTTP requests will come into the OpenShift environment, which will proxy those requests to your application.
HTTPリクエストは、アプリケーションへのプロキシこれらの要求をれる、OpenShift環境に来る。
Your application will reply with HTTP responses, and the OpenShift environment will relay those responses back to your users.
アプリケーションは、HTTPレスポンスで応答し、OpenShift環境がユーザーに戻ってそれらの応答を中継します。

Your application will be executed by the .openshift/action_hooks/start script, and will be stopped by the .openshift/action_hooks/stop script.
アプリケーションが.openshift/ action_hooksによって実行/スクリプトを起動し、スクリプトを停止/.openshift/ action_hooksによって停止されますされます。

To learn more about how it works, follow along with as we construct a simple C application, and then run it as an OpenShift DIY.
それがどのように動作するかの詳細については、我々は単純なCアプリケーションを構築し、OpenShift DIYとしてそれを実行するようにと一緒に従ってください。
We will use the libmicrohttpd library so we dont have to write our own HTTP server.
我々は独自のHTTPサーバを書くために持っていけないので、我々はlibmicrohttpdライブラリを使用します。

Run the following commands at a shell prompt on your own Linux or MacOS machine.
独自のLinuxやMacOSのマシンのシェルプロンプトで次のコマンドを実行します。

svn checkout https: //gnunet.org/svn/libmicrohttpd/src-libmicrohttpd
cd src-libmicrohttpd
autoreconf -fi
mkdir ${HOME}/lib-libmicrohttpd
./configure --prefix=${HOME}/lib-libmicrohttpd make && make install
cd ${HOME}

Next, we download the binhello.c sample program.
次に、我々はbinhello.cサンプルプログラムをダウンロードしてください。

curl -NOL https ://raw.github.com/openshift/openshift-diy-binhello-demo/master/binhello.c

This was originally the "hellobrowser.c" from the libmicrohttpd examples, but has been modified to run in OpenShift, by looking for the OPENSHIFT_INTERNAL_IP and OPENSHIFT_INTERNAL_PORT environment variables, and then binding to and listening on that address and port.
これは、もともとlibmicrohttpdの例から "hellobrowser.c"でしたが、OPENSHIFT_INTERNAL_IPとOPENSHIFT_INTERNAL_PORT環境変数を探し、その後に結合し、そのアドレスとポートをリッスンすることによって、OpenShiftで実行するように変更されています。

Next, we compile the program. We will statically link the libmicrohttpd.a object instead of using the .so shared object libraries.
次に、我々はプログラムをコンパイルします。我々は静的ますので、共有オブジェクト·ライブラリを使用する代わりにlibmicrohttpd.aオブジェクトをリンクします。
We could instead include the shared object library files into our application, and then play with LD_PRELOAD, but that is more than we want to do for this demo.
我々は代わりに私たちのアプリケーションに共有オブジェクトライブラリファイルを含めることができますし、LD_PRELOADと遊ぶ、それは我々がこのデモのために何をしたい以上です。

gcc -o binhello binhello.c ${HOME}/lib-libmicrohttpd/lib/libmicrohttpd.a -L ${HOME}/lib-libmicrohttpd/include -pthread

If we want to skip that step, and avoid playing with the GCC compiler, we can instead download a precompiled binary:
私達はそのステップをスキップして、GCCコンパイラと一緒に遊んで回避したい場合は、代わりにコンパイル済みのバイナリをダウンロードすることができます。

curl -NOL https ://raw.github.com/openshift/openshift-diy-binhello-demo/master/binhello
chmod +x ./binhello

Next, we create the OpenShift application container.
次に、我々はOpenShiftアプリケーションコンテナを作成します。
We will name this application jamie, after one of the kings of Do It Yourself: Jamie Hyneman.
ジェイミーHyneman:我々はそれを自分の王の一人した後、このアプリケーションジェイミー名前を付けます。

rhc-create-app -a jamie -t diy-0.1

Next, we place our binary into the local git repo we just created.
次に、先ほど作成したローカルのgitリポジトリに我々のバイナリを配置します。

mkdir jamie/bin
mv binhello jamie/bin
cd jamie
git add bin/binhello

Next, we tell OpenShift how to run our program. We go into the .openshift/action-hooks directory
次に、我々はプログラムを実行する方法をOpenShift教えてください。我々は.openshift/アクションフックディレクトリに移動

cd .openshift/action_hooks

and replace the start script with the following text:
次のテキストで起動スクリプトを置き換えます。

#!/bin/bash
cd $OPENSHIFT_REPO_DIR/bin
nohup ./binhello >;${OPENSHIFT_LOG_DIR}/binhello.log 2>&1 &

We are redirecting the UNIX standard output and standard error to a file in the OpenShift logging directory, and using nohup to assure that the program properly runs in the background.
我々はディレクトリを記録しているOpenShiftでUNIX標準出力と標準エラーをファイルにリダイレクトしていて、プログラムがバックグラウンドできちんと動作することを保証するために、nohupを使っています。

Next, we replace the stop script with the following text:
次に、我々は停止スクリプトを以下のテキストと入れ替えます:

#!/bin/bash
kill `ps -ef | grep binhello | grep -v grep | awk '{ print $2 }'` >; /dev/null 2>&1
exit 0

We make sure those scripts are still executable.
我々は、それらのスクリプトがまだ実行可能なことを確認します。

chmod +x start stop

Now, we go back to the top directory of our application, commit it to git, and push it up to the OpenShift servers.
現在、我々はアプリケーションの一番上のディレクトリに戻って、それをクズに任せて、それをOpenShiftサーバーまで上げます。

cd ../..
git commit -a -m "install the binhello binary and start stop scripts"
git push

We can then browse to the application.
それから、我々はアプリケーションに閲覧することができます。
In my case, it will be http://jamie-matwood.rhcloud.com/.
私のケースでは、それはhttp://jamie-matwood.rhcloud.com/.です。
We should see a very simple Hello, World!
我々は、非常に単純なハローワールドを見なければなりません!

And that is all there is to it!
そして、つまり、そこのすべては、それにあります!

Using the DIY application type, you can do all sorts of crazy things.
DIYアプリケーション・タイプを使って、あなたはいろいろな狂ったことをすることができます。
Do you have a favorite scripting language that OpenShift does not yet support?
OpenShiftがまだサポートしない大好きなスクリプト言語が、あなたにはありますか?
Do you have a framework written in Smalltalk?
あなたは、フレームワークをSmalltalkで書いておきますか?
Do you have a HTTP server written in Fortran?
あなたは、HTTPサーバをFortranで記述しておきますか?
Do you have a control server for a model train?
あなたには、模型の電車のために制御サーバーがありますか?
With DIY, you can run it on OpenShift.
DIYで、あなたはOpenShiftの上でそれを走らせることができます。

We would like to extend a challenge:
挑戦を延長したいです:
If you do something useful, amazing, or crazy with the DIY application container, please contact us at openshift@redhat.com, or tell us on the OpenShift Forums or come to IRC at freenode.net #openshift. We want to hear from you!
あなたがDIYアプリケーション容器で役に立つか、素晴らしいか、おかしく何かするならば、openshift@redhat.comで我々に連絡してください、さもなければ、OpenShift Forumsの上で我々に言うか、freenode.net #openshiftでIRCに来てください。 我々は、あなたから連絡をもらいたいです!