Ignore:
Timestamp:
May 13, 2011, 6:42:42 PM (12 years ago)
Author:
work@…
Message:
  • working version of the setup wizard, see #185
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/setup/pages/_database.gsp

    r1651 r1846  
    1313%>
    1414<af:page>
    15 <h1>Database configuration</h1>
     15        <h1>Database configuration</h1>
    1616
     17        <af:selectElement name="dataSource.driverClassName" description="database type" error="driver" optionKey="name" optionValue="description" from="[[name:'org.postgresql.Driver', description:'PostgreSQL (prefered)'],[name:'org.hsqldb.jdbcDriver', description: 'In memory']]" value="${configInfo?.properties.getProperty('dataSource.driverClassName')}">
     18                Choose the database of choice. Note that while this application in principle supports different database types, it is specifically developer for PostgreSQL. Choosing
     19                a different database may result in unexpected issues therefore choosing PostgreSQL here is advisable.
     20                Also note that the In Memory database exists only at runtime, which means the database is lost when the application is restarted!
     21        </af:selectElement>
     22        <af:textFieldElement name="dataSource.url" description="url" error="url" value="${configInfo?.properties.getProperty('dataSource.url')}" style="width: 300px;">
     23                The URL of your database, example » jdbc:postgresql://localhost:5432/gscf-ci
     24        </af:textFieldElement>
     25        <af:textFieldElement name="dataSource.username" description="username" error="username" value="${configInfo?.properties.getProperty('dataSource.username')}" style="width: 100px;">
     26                The username for this database
     27        </af:textFieldElement>
     28        <af:textFieldElement name="dataSource.password" description="password" error="password" value="${configInfo?.properties.getProperty('dataSource.password')}" style="width: 100px;">
     29                The password for this database
     30        </af:textFieldElement>
     31        <af:selectElement name="dataSource.dbCreate" description="database creation type" error="dbcreate" optionKey="name" optionValue="description" from="[[name:'update', description:'Create/Update the existing database if changes are required (prefered choice)'],[name:'create', description:'Create the database if required, but do not perform updates'],[name:'create-drop', description: 'Drop the exisiting database and create a fresh database']]" value="${configInfo?.properties.getProperty('dataSource.dbCreate')}">
     32                The application is able to automatically create and update your database. Choose what option suites you best.
     33        </af:selectElement>
     34
     35        <g:if test="${connection==false}">
     36        <span class="info">
     37                <span class="error">Could not connect to database</span>
     38                Please make sure the database settings are correct
     39                <g:if test="${configInfo?.properties.getProperty('dataSource.driverClassName') == 'org.postgresql.Driver'}">
     40                or create the database and database user if you did not yet do so.<br/>
     41
     42                First, as root, change to user postgres and start the Postgres console:
     43                <pre class="brush:plain">
     44                        su - postgres
     45                        psql
     46                </pre>
     47
     48                Then run the following commands:
     49                <pre class="brush:plain">
     50                        create database "${configInfo?.properties.getProperty('dataSource.url').split("/").last()}";
     51                        create user ${configInfo?.properties.getProperty('dataSource.username')} with password '${configInfo?.properties.getProperty('dataSource.password')}';
     52                        grant all privileges on database "${configInfo?.properties.getProperty('dataSource.url').split("/").last()}" to ${configInfo?.properties.getProperty('dataSource.username')};
     53                        ALTER DATABASE "${configInfo?.properties.getProperty('dataSource.url').split("/").last()}" OWNER TO ${configInfo?.properties.getProperty('dataSource.username')};
     54                </pre>
     55
     56                When finished, click <i>next</i> to try again.
     57                </g:if>
     58        </span>
     59        </g:if>
    1760
    1861</af:page>
Note: See TracChangeset for help on using the changeset viewer.