support for postgresql (#37)

This commit is contained in:
Athou
2013-05-08 09:28:18 +02:00
parent eaef35e990
commit ae7d0c4ab7
3 changed files with 27 additions and 2 deletions

View File

@@ -36,19 +36,22 @@ To install maven and openjdk on Ubuntu, issue the following commands
Now build the application
Embedded HSQL database (not recommended, ok for quick tests):
Embedded HSQL database (not recommended, ok for quick tests but automatic schema updates are not working):
mvn clean package tomee:build -Pprod
External MySQL database:
mvn clean package tomee:build -Pprod -Pmysql
External PostgreSQL database:
mvn clean package tomee:build -Pprod -Ppgsql
It will generate a zip file at `target/commafeed.zip` with everything you need to run the application.
* Create a directory somewhere (e.g. `/opt/commafeed/`) and extract the generated zip inside this directory.
* Create a directory called `logs` (e.g. `/opt/commafeed/logs`)
* On Linux, create the file `bin/setenv.sh` and put the following in it : `export JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"`
* On Windows, create the file `bin/setenv.bat` and put the following in it : `set JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"`
* If you used the MySQL option, create a database in your MySQL instance, then uncomment the `Resource` element from `conf/tomee.xml` and edit the default credentials.
* If you don't use the embedded database, create a database in your external database instance, then uncomment the `Resource` element corresponding to the database engine you use from `conf/tomee.xml` and edit the default credentials.
* If you'd like to change the default port (8082), edit `conf/server.xml` and look for `<Connector port="8082" protocol="HTTP/1.1"`. Change the port to the value you'd like to use.
* CommaFeed will run on the `/commafeed` context. If you'd like to change the context, go to `webapps` and rename `commafeed.war`. Use the special name `ROOT.war` to deploy to the root context.
* To start and stop the application, use `bin/startup.sh` and `bin/shutdown.sh` on Linux (you may need to `chmod +x bin/*.sh`) or `bin\startup.bat` and `bin\shutdown.bat` on Windows.

View File

@@ -104,6 +104,7 @@
<lib>remove:hsqldb</lib>
<lib>org.hsqldb:hsqldb:SNAPSHOT</lib>
<lib>mysql:mysql-connector-java:5.1.24</lib>
<lib>postgresql:postgresql:9.1-901.jdbc4</lib>
</libs>
</configuration>
</plugin>
@@ -428,6 +429,13 @@
<jpa.dialect>com.commafeed.backend.MySQL5Dialect</jpa.dialect>
</properties>
</profile>
<profile>
<id>pgsql</id>
<properties>
<jpa.datasource.name>java:openejb/Resource/PostgreSQL</jpa.datasource.name>
<jpa.dialect>org.hibernate.dialect.PostgreSQLDialect</jpa.dialect>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>

View File

@@ -9,6 +9,20 @@
MaxActive 50
</Resource>
-->
<!--
<Resource id="PostgreSQL" type="DataSource">
JdbcDriver org.postgresql.Driver
JdbcUrl jdbc:postgresql://localhost:5432/commafeed
UserName cf
Password cf
MaxActive 50
</Resource>
-->
<Container id="CommaFeedStateless" type="STATELESS">
PoolSize=50
StrictPooling=false