I am using sunpot_rails gem with the following config in sunspot.yml:
test:
solr:
hostname: localhost
port: <%= 8990 + (ENV['TEST_ENV_NUMBER'] || '1').to_i %>
path: /solr/test
pid_dir: solr/pids/test<%= ENV['TEST_ENV_NUMBER'] %>
data_path: solr/test<%= ENV['TEST_ENV_NUMBER'] %>/data
It is successfully reading different port and pid_dir when I change the TEST_ENV_NUMBER environment variable.
However my problem is that it always points to the same data directory and data_path has no effect. Actually an empty directory is created but solr admin shows the same path. See below for /default/data being used.
I am aware that a recent commit removed that configuration, but I am using my own branch.
To answer my question, I will first tell why I need to change the data directory from the sunspot config files, rather than from solr configuration.
I wanted to have multiple instances of Solr to run tests in parallel using the parallel_tests gem.
I figured out that only 1 Solr instance is needed. However, parallel tests can be achieved through 1 running instance but with multiple Solr cores.
To do this you need to update solr/solr.xml by adding more cores:
<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false">
<cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:}">
<core name="default" instanceDir="." dataDir="default/data"/>
<core name="development" instanceDir="." dataDir="development/data"/>
<core name="test" instanceDir="." dataDir="test/data"/>
<core name="test2" instanceDir="." dataDir="test2/data"/>
<core name="test3" instanceDir="." dataDir="test3/data"/>
<core name="test4" instanceDir="." dataDir="test4/data"/>
<core name="test5" instanceDir="." dataDir="test5/data"/>
<core name="test6" instanceDir="." dataDir="test6/data"/>
<core name="test7" instanceDir="." dataDir="test7/data"/>
<core name="test8" instanceDir="." dataDir="test8/data"/>
</cores>
</solr>
Then restart Solr to create those new cores:
RAILS_ENV=test bundle exec rake sunspot:solr:restart
Then modify config/sunspot.yml by appending the environment variable to the path:
test:
solr:
hostname: localhost
port: 8981
log_level: DEBUG
path: /solr/test<%= ENV['TEST_ENV_NUMBER'] %>
Now whenever you run the parallel tests, the appropriate path/core will be selected:
bundle exec rake parallel:spec
Related
I have been stuck with this issue longer than i want to admit. I am trying to use postgres db connection for my small spring mvc project over liberty. My server.xml looks like below.
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>jdbc-4.2</feature>
<feature>jsp-2.3</feature>
<feature>localConnector-1.0</feature>
<feature>servlet-4.0</feature>
<feature>ldapRegistry-3.0</feature>
<feature>appSecurity-3.0</feature>
<feature>transportSecurity-1.0</feature>
</featureManager>
<ssl id="defaultSSLSettings" keyStoreRef="defaultKeyStore" trustDefaultCerts="true" />
<keyStore id="defaultKeyStore"
location="/opt/ibm/wlp/usr/servers/defaultServer/resources/security/key.jks"
password="changeIt"/>
<dataSource id="DefaultDataSource" jndiName="jdbc/postgres"
transactional='true' type='javax.sql.ConnectionPoolDataSource'>
<jdbcDriver libraryRef="PostgresLib" />
<properties databaseName="clouddb"
password=""
serverName="ea957de9-2271-4d6c-999e-f2c250575850.budepemd0im5pmu4u60g.databases..cloud"
user="admin" portNumber="30352" />
</dataSource>
<library id="PostgresLib">
<fileset
dir="C:/Users/AkanchaSingh/Desktop/iit-test-app/test-app"
includes="postgresql-42.2.5.jre6.jar" />
</library>
<httpEndpoint host="*" httpPort="9080" httpsPort="9443"
id="defaultHttpEndpoint">
<tcpOptions soReuseAddr="true" />
<httpOptions maxKeepAliveRequests="-1" />
</httpEndpoint>
<applicationManager autoExpand="true"
startTimeout="600" stopTimeout="600"></applicationManager>
<applicationMonitor updateTrigger="mbean" />
<webApplication autoStart="true" contextRoot="test"
id="test" location="/opt/ibm/wlp/usr/servers/defaultServer/test.war"
name="test">
</webApplication>
</server>
I have tried connecting to postgres by all methods eg: datasource and also connection manager
Properties info = new Properties();
String url = "jdbc:postgresql://ea957de9-2271-4d6c-999e-f2c250575850.budepemd0im5pmu4u60g.databases.appdomain.cloud:30352/clouddb";
info.setProperty("user", "");
info.setProperty("password", "");
info.setProperty("ssl", "true");
info.setProperty("sslfactory", "org.postgresql.ssl.SingleCertValidatingFactory");
info.setProperty("sslfactoryarg", loadFile("/opt/ibm/wlp/usr/servers/defaultServer/resources/security/PGSSLROOTCERT.crt"));
Even after providing the root.crt from the postgres db connection page I keep getting
[err] org.postgresql.util.PSQLException: SSL error: Received fatal alert: handshake_failure
[err] at org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:42)
[err] at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:435)
[err] at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:94)
[err] at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
[err] at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
[err] at org.postgresql.jdbc.PgConnection.(PgConnection.java:195)
I also have tried to pass the certificate in my keystore and truststore.. Nothing seems to work in this case.. I can connect successfully to the postgres db locally via IDE and also through psql but as soon as i dockerize it and run, it throws this exception.
DockerFile:
FROM websphere-liberty:19.0.0.12-full-java8-ibmjava
ENTRYPOINT ["/opt/ibm/wlp/bin/server","run","defaultServer"]
USER root
EXPOSE 9080
COPY --chown=1001:0 server.xml /opt/ibm/wlp/usr/servers/defaultServer/
RUN mkdir -p /root/.postgresql
COPY --chown=1001:0 root.crt /root/.postgresql/
COPY --chown=1001:0 key.jks /opt/ibm/wlp/usr/servers/defaultServer/resources/security/
RUN chmod -R 777 /opt/ibm/wlp/usr/servers/defaultServer/resources/security
COPY --chown=1001:0 target/test.war /opt/ibm/wlp/usr/servers/defaultServer/
RUN installUtility install --acceptLicense defaultServer
RUN chmod -R 777 /opt/ibm/wlp/output/defaultServer/workarea
RUN chmod a+rwx /opt/ibm/wlp/output/defaultServer
OpenLiberty has an automated test bucket that runs with PostgreSQL in a docker container, where 2 of the Liberty servers use SSL successfully. Here is one of them:
https://github.com/OpenLiberty/open-liberty/blob/integration/dev/com.ibm.ws.jdbc_fat_postgresql/publish/servers/server-PostgreSQLSSLTest/server.xml
Try using the <properties.postgresql> element under your <dataSource> instead of the generic <properties>. The former has additional properties for ssl on it, as illustrated in the server.xml of the test case.
I am running the kie-server-showcase docker image and attempting to run a very simple rule on it.
I start the container as so:
docker run -i -p 8080:8080 --name kie-server --mount type=bind,source=$HOME/.m2,target=/opt/jboss/.m2 jboss/kie-server-showcase:latest
I need to use a bind mount as I'm just using my local .m2 maven repository (for now) and this was the only way I could see to get the container to get a copy of it.
I have built a kjar in Eclipse via "maven clean" followed by "maven install".
Inside the kjar (.jar) I have:
META-INF which contains kmodule.xml and MANIFEST.MF, also a maven subfolder which has the group-id followed by artifact-id in subfolders, i.e. META-INF > maven > group > artifact. The artifact folder contains the pom and pom.properties (which then defines the GAV).
my drl and bpmn
To create the container on the kie-server I use a curl command:
curl -u 'admin:admin' -H "accept: application/xml" -H "content-type: application/xml" -d #myContainer.xml -X PUT http://localhost:8080/kie-server/services/rest/server/containers/MyContainer
It then begins running the command but the time spent continues to tick on and was still going after I had left it for 30 minutes.
I checked the kie-server containers and the one I have added is there but the status is CREATING:
<response type="SUCCESS" msg="List of created containers">
<kie-containers>
<kie-container container-id="MyContainer" status="CREATING">
<release-id>
<artifact-id>hummingbird.rules.syndicated-kjar</artifact-id>
<group-id>uk.co.cdl.hummingbird</group-id>
<version>0.0.1-SNAPSHOT</version>
</release-id>
<scanner status="DISPOSED"/>
</kie-container>
</kie-containers>
</response>
I'm not very experienced with docker or using the kie-server, and in the past have not used kjars but had a custom rules engine that has loaded the drl and bpmn individually.
I believe it may be down to my kjar not being correct in some way. The docker container seems to see the kjar in the local maven repo mount (as I was previously getting errors that it couldn't find it).
The drl in the kjar is very simple:
package somerules
import org.json.JSONObject
import java.util.Map
rule "somerules - do something" ruleflow-group "somerules"
dialect "java"
when
$root : Map()
then
insert(new JSONObject());
delete($root);
end
And the bpmn should not be an issue (it is the same one used previously with our custom rulesengine):
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<process processType="Private" isExecutable="true" id="somerules" name="somerules" tns:packageName="somerules" >
<!-- nodes -->
<startEvent id="_1" isInterrupting="true"/>
<endEvent id="_jbpm-unique-0" name="End" >
<terminateEventDefinition />
</endEvent>
<businessRuleTask id="_jbpm-unique-2" name="somerules" g:ruleFlowGroup="somerules" >
<ioSpecification>
<inputSet>
</inputSet>
<outputSet>
</outputSet>
</ioSpecification>
</businessRuleTask>
<!-- connections -->
<sequenceFlow id="_jbpm-unique-2-_jbpm-unique-0" sourceRef="_jbpm-unique-2" targetRef="_jbpm-unique-0" />
<sequenceFlow id="_1-_jbpm-unique-2" sourceRef="_1" targetRef="_jbpm-unique-2" />
</process>
<bpmndi:BPMNDiagram>
...
</bpmndi:BPMNDiagram>
</definitions>
I am building the kjar with drools 7.23.0.Final. I previously tried 7.22 as well.
Any advice appreciated, thanks.
I found out what the issue was, mainly by following advice given and trying to run the kie-server without Docker.
I got a lot of error messages (which were not visible to me in Docker) regarding dependencies and errors along the lines of "class X and class Y disagree on Z attribute".
This was because my kjar pom had dependencies already provided in the kie-server and there seemed to be conflicts. It was all the drools dependencies. By setting the scope to "provided" in the kjar pom for these dependencies, the issue was resolved and I could create the container (both in Docker and non-Docker kie-servers).
I attempted to create a new project in kie-workbench (6.2.0.Final) and deploy it to the remote kie-server (6.2.0.Final). I create the container via the workbench then hit the "start" button for the container. When I hit start, a red error icon appears next to the server and the container.
When I go to the URL specified in the Container Info side panel, (http://192.168.1.11:8080/kie-server-6.2.0.Final-webc/services/rest/server/containers/test
) I get the following response XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Info for container test">
<kie-container container-id="test" status="FAILED">
<scanner status="DISPOSED"/>
</kie-container>
</response>
Is there a log file I can go to get more information? I am running kie-server and kie-workbench on Tomcat 7.
Maybe 'TOMCAT_HOME\logs\catalina.log' is what you're looking for? If you also want to see the log in terminal, you can modify 'TOMCAT_HOME\logs\startup.sh'. That is, changing
exec "$PRGDIR"/"$EXECUTABLE" start "$#"
into
exec "$PRGDIR"/"$EXECUTABLE" run "$#"
Though I can make some containers start up correctly, I'm still facing some problems, see this.
For your reference, I can see the following response on the link you provide when container started up correctly:
<response type="SUCCESS" msg="List of created containers">
<kie-containers>
<kie-container container-id="droolsTest" status="STARTED">
<release-id>
<artifact-id>droolsTestProj</artifact-id>
<group-id>demo</group-id>
<version>2.0</version>
</release-id>
<resolved-release-id>
<artifact-id>droolsTestProj</artifact-id>
<group-id>demo</group-id>
<version>2.0</version>
</resolved-release-id>
<scanner status="DISPOSED"/>
</kie-container>
</kie-containers>
</response>
I created a mailstream with following command -------
stream create --name mailstream --definition "mail --host=imap.gmail.com --username=yyyyyyyy12#gmail.com --password=my password | file --dir=/tmp/gmailData" --deploy
Refer -http://docs.spring.io/spring-xd/docs/1.0.0.BUILD-SNAPSHOT/reference/html/#modules
But in the xd-singletone console I get -
Caused by: javax.mail.AuthenticationFailedException: failed to connect, no password specified?
How to resolve this issue.
Also --password=secret - how to keep my password invisible or secret in the XD shell
/shankha
You need to escape "#" with "%40" for both username and password and to specify --port=993 for gmail. Also, it may be possible not to work with the default settings as GMail requires SSL for imap and this needs to be configured as well.
So, I would suggest the following (basically, creating a new source module):
Go to spring-xd-1.0.0.M6\xd\modules\source and make a copy of mail folder and name this copy gmail
Go to spring-xd-1.0.0.M6\xd\modules\source\gmail\config and rename both mail.properties and mail.xml to gmail.properties and gmail.xml respectively
Inside gmail.xml replace everything with:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:file="http://www.springframework.org/schema/integration/file"
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<channel id="output" />
<int-mail:mail-to-string-transformer
charset="${charset}" input-channel="transform" output-channel="output" />
<beans:beans profile="use-polling">
<int-mail:inbound-channel-adapter
store-uri="${protocol}://${username:}:${password:}#${host}:${port}/${folder}"
channel="transform" should-mark-messages-as-read="${markAsRead}"
should-delete-messages="${delete}" java-mail-properties="javaMailProperties">
<poller fixed-delay="${fixedDelay}" time-unit="SECONDS">
<advice-chain>
<beans:bean
class="org.springframework.xd.dirt.module.support.ThreadContextClassLoaderSetterAdvice" />
</advice-chain>
</poller>
</int-mail:inbound-channel-adapter>
</beans:beans>
<beans:beans profile="use-idle">
<int-mail:imap-idle-channel-adapter
store-uri="${protocol}://${username:}:${password:}#${host}:${port}/${folder}"
channel="transform" auto-startup="true" mail-filter-expression="${expression}"
should-mark-messages-as-read="${markAsRead}"
should-delete-messages="${delete}" java-mail-properties="javaMailProperties">
</int-mail:imap-idle-channel-adapter>
</beans:beans>
<beans:beans profile="default">
<util:properties id="javaMailProperties">
<beans:prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</beans:prop>
<beans:prop key="mail.imap.socketFactory.fallback">false</beans:prop>
<beans:prop key="mail.store.protocol">imaps</beans:prop>
<beans:prop key="mail.debug">false</beans:prop>
</util:properties>
</beans:beans>
</beans:beans>
4. In XD shell now you will use something like the following to create your stream:
stream create --name myGmailStream --definition "gmail --host=imap.gmail.com --username=yyyyyyyy12%40gmail.com --password=my_password --port=993 | file --dir=/tmp/gmailData" --deploy
Here, please note the following:
I added --port=993
the username contains "%40" instead of "#"
the definition of the stream starts with "gmail
if your password contains "#" you need to replace that with "%40" as well
What I've done above is to, basically, create a new custom module (a source) which is kind of easy (more details about this you can find in the documentation). The XD single node or the XD Shell doesn't even need to be restarted. Give it a try and let me know how it goes.
Regarding the password that you don't want to appear as part of the stream definition, you can provide it as part of your mail module options, as described here: http://docs.spring.io/spring-xd/docs/1.0.0.BUILD-SNAPSHOT/reference/html/#_module_configuration
ie
<xd_home>/config/modules/source/mail/mail.properties:
password: yourpassword
my first try was to simple proxy a service from one location to another, and it work just fine, right now i need some help in how to change part of the service location, for example, the retrieved WSDL point 4 services to a machine, i need to change 1 of those services for another server, is that even possible? If so, how do i do it?
Mule Version CE 3.4.
my code atm is as follow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ssl="http://www.mulesoft.org/schema/mule/ssl" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.4/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.4/mule-http.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.4/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.4/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.mulesoft.org/schema/mule/ssl http://www.mulesoft.org/schema/mule/ssl/current/mule-ssl.xsd" version="EE-3.4.0">
<mule-ss:security-manager>
<mule-ss:delegate-security-provider
name="memory-dao" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="asd" password="asd" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<https:connector name="httpsConnector">
<https:tls-key-store path="${mule.home}/conf/keystore.jks"
keyPassword="1234567" storePassword="1234567" />
</https:connector>
<pattern:web-service-proxy name="Service"
inboundAddress="https://LocalAdress.com:443/services/Service"
outboundAddress="http://RemoteAddress.com/services/Service.svc"
wsdlLocation="http://RemoteAddress.com/services/Service.svc?singleWSDL"/>
Mule doesn't offer a mechanism to realize this type of WSDL customization. What you have to do is:
download "http://RemoteAddress.com/services/Service.svc?singleWSDL",
customize it by hand,
embed the customized version in your project (say in "src/main/resources"),
serve it with wsdlFile="yourCustom.wsdl"