Skip to content

A Java/JavaScript blogging platform oriented towards photography. I have developed it for my personal website at https://www.terrestrialjournal.com

License

Notifications You must be signed in to change notification settings

Alasdair1907/MagicJournal

Repository files navigation

MagicJournal is a blogging platform with an accent on photography content. It separates posts into three main categories: articles, photos and galleries.
Articles are text posts that allow embedding different elements, such as images, videos, files. Articles can be formatted with custom BBCode.
Photos are posts that have a brief description (1000 characters) and a single image.
Galleries also have a brief description (1000 characters) and a collection of images.

Geo Data

All posts can be tied to a specific location. Users can see the posts on the map.

Post Relation System

Relations get displayed in a side panel in the post view. There are two categories of relations.
An article can use an image from other gallery. In that case, an Associated connection will be automatically created between the article and the gallery.
A manual connection, called Related, can be created between any two posts.

Mobile and Desktop compatible template

Website template is optimized for both handheld devices and desktop.

Admin

Content is managed through the administration panel. More users with various privileges can be created.

To get this code running:

  1. Make sure that you have the following installed:

    • Java 14+ (because of latest gradlew updates, probably Java 17)
    • PostgreSQL (12+)
    • GIT

    Download tomcat from http://tomcat.apache.org/ Compatible versions: 9.0.90 or newer (10.x not currently supported because of different package paths - jakarta instead of javax)

  2. Get the source code: git clone https://github.com/Alasdair1907/MagicJournal.git

  3. Set up SQL:

    • Create a database (in this example, database is demodb with user demo and password demo123)
    • Put database info into the hibernate config at /src/main/resources/hibernate.cfg.xml
      Edit these lines:

    <property name="connection.url">jdbc:postgresql://localhost:5432/demodb</property>
    <property name="connection.username">demo</property>
    <property name="connection.password">demo123</property>

    • Create the tables by executing the sql script at /src/misc/create-tables.postgres.sql:
      psql -U demo -h localhost -d demodb -f create-tables.postgres.sql
  4. Copy contents of the tomcat lib folder (the one inside the downloaded tomcat archive) to the project's /lib folder Open the web.xml file, edit the path for temporary storage of uploaded files (inside the tag)

  5. Build the project:
    ./gradlew build
    (on windows, gradlew.bat build)

    If the project has been built successfully, you will see the following message: BUILD SUCCESSFUL

  6. Deploy .WAR file
    You will find the compiled Web ARchive (.war) file in the /build/libs/ directory.
    You can simply copy it to the webapps folder of tomcat, name it ROOT.war (make sure that there is no directory named ROOT), and run the tomcat from the bin folder by executing ./catalina.sh run

  7. Set up the vital parts of the blog:

    • Make a folder for image and file storage, for example, at /home/user/imageStorage and /home/user/fileStorage
    • In your browser navigate to localhost:8080/admin, log in as 'admin' with password 'password' Click 'Settings'

    Edit these settigns:

    • Image Storage Path (for example /home/user/imageStorage)
    • Storage Path for Non-Image Files (for example /home/user/fileStorage)
    • Set the dimensions for preview images (1280 recommended) and thumbnail images (800 recommended)

You can change background and logo by changing /web/template/background.jpg and /web/template/logo-full-white.png