Last active
May 10, 2016 14:35
-
-
Save niklv/2c135f91aa55ab281d82fe7942544b53 to your computer and use it in GitHub Desktop.
Wildfly with postgresql connector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $WILDFLY_HOME/bin/jboss-cli.sh --file=/path/to/this/file. | |
embed-server | |
#batch | |
module add --name=org.postgresql --resources=/opt/jboss/postgresql-POSTGRESQL-JDBC-DRIVER-VERSION.jar --dependencies=javax.api,javax.transaction.api | |
/subsystem=datasources/jdbc-driver=postgresql:add(driver-module-name=org.postgresql,driver-name=postgresql,driver-class-name=org.postgresql.Driver) | |
#deploy /opt/jboss/postgresql-POSTGRESQL-JDBC-DRIVER-VERSION.jar | |
#data-source add --name=PostgresDS --driver-name=postgresql-POSTGRESQL-JDBC-DRIVER-VERSION.jar --jndi-name=java:/datasources/PostgresDS --connection-url=jdbc:postgresql://${postgres.ipaddress}:${postgres.port}/${postgres.database} --user-name=${postgres.username} --password=${postgres.password} | |
#list-batch | |
#run-batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM jboss/wildfly | |
MAINTAINER Nikita Lvov | |
USER jboss | |
ENV POSTGRESQL_JDBC_DRIVER_VERSION 9.4-1206-jdbc42 | |
RUN curl -O http://central.maven.org/maven2/org/postgresql/postgresql/${POSTGRESQL_JDBC_DRIVER_VERSION}/postgresql-${POSTGRESQL_JDBC_DRIVER_VERSION}.jar | |
ADD datasource.cli /opt/jboss/datasource.cli | |
RUN sed -i -e s/POSTGRESQL-JDBC-DRIVER-VERSION/${POSTGRESQL_JDBC_DRIVER_VERSION}/g /opt/jboss/datasource.cli | |
RUN /opt/jboss/wildfly/bin/jboss-cli.sh --file=/opt/jboss/datasource.cli | |
# Fix for WFLYCTL0056: Could not rename /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/current to ... | |
RUN rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history | |
RUN rm -rf postgresql-${POSTGRESQL_JDBC_DRIVER_VERSION}.jar | |
RUN /opt/jboss/wildfly/bin/add-user.sh admin 123456 --silent | |
USER root | |
EXPOSE 8080 9990 | |
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment