eclipse-archived / ceylon-herd

The Ceylon repository web application
Apache License 2.0
21 stars 11 forks source link

How to run the Ceylon Herd Module Repository

Note: at the moment Herd requires Play 1.2 which does not work on Java 8, so proceed with Java 7. We are going to move it to Play 1.3 as soon as possible to fix that.

  1. Download Play Framework 1.2.7.2 and install it
  2. Clone the Herd repository
  3. Open a shell and go to the ceylon-herd directory you just cloned
  4. Run play dependencies to setup the required modules

    • Note: the play script requires Python 2, but runs on /usr/bin/env python, which may default to Python 3 depending on your system. If you get an error like this:

      File "/tmp/play-1.2.7.2/play", line 50
        print r"~        _            _ "
                                        ^
      SyntaxError: Missing parentheses in call to 'print'

      then change the first line of the script to

      #!/usr/bin/env python2
    • Note 2: This will pretend to fail due to not being able to find db but in fact they are already there. This is due to Play apparently having removed their Maven repo online. Those two modules have been added to our Git repo so we have them, but this step is still necessary in order to set up the secure module which comes from the Play distribution itself. Ignore the two errors and move on: it should work.
  5. Create your Postgres DB
    1. sudo su - postgres
    2. createuser -PSRD ceylon-herd
    3. enter ceylon-herd as password when prompted
    4. createdb -O ceylon-herd -E utf8 ceylon-herd
    5. exit
  6. Run the application
    1. play run

How to make your user (if registration is disabled, which is the default for now)

This can only be done by hand for now:

  1. Pick a (dummy temporary) password
  2. Hash it with BCrypt (for example, online at http://bcrypthashgenerator.apphb.com or other locations)
    1. Copy the resulting BCrypt Hash
    2. Don't worry about giving your password online, just pick a dummy temporary password and you can change it later in Herd.
  3. Open a psql console to your database:
    1. psql -h localhost -U ceylon-herd
  4. Add your user (as admin)
    1. INSERT INTO user_table (id, email, firstname, admin, lastname, isbcrypt, password, status, username) VALUES ((select nextval('hibernate_sequence')), 'email@example.org', 'FirstName', true, 'LastName', true, 'YOUR_BCRYPT_HASH', 'REGISTERED', 'UserName');
  5. You can now log in and change your password using the UI

How to make your user admin (if registration is enabled)

This can only be done by hand for now:

  1. Register your user at http://localhost:9000/register
  2. See in the logs in the console what your activation link is, and follow it (in DEV mode no mail is sent)
  3. Complete your registration
  4. Open a psql console to your database:
    1. psql -h localhost -U ceylon-herd
  5. Set yourself as admin
    1. UPDATE user_table SET admin = true WHERE username = 'your-user-name';

Updating the DB to a new version

Just run the query-db-version.sh command to see if and how to update

Troubleshooting

  1. If you get the error FATAL: Ident authentication failed for user "ceylon-herd" look here for a possible solution

Setting up Herd in Eclipse

  1. Create a project using Play by going to the ceylon-herd project and running:
    1. play eclipsify
  2. Import the resulting project into Eclipse

This also creates some useful launch configurations in the eclipse folder that you can use to run the application within Eclipse. But unfortunately the configurations are not 100% correct, so to make things work you need to go into the properties of each configuration and add the following to the VM Arguments section: -XX:-UseSplitVerifier -Dfile.encoding=utf-8 -XX:CompileCommand=exclude,jregex/Pretokenizer,next

License

The content of this repository is released under ASL2 as provided in the LICENSE file that accompanied this code.