Giter Site home page Giter Site logo

vin500 / minitwit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karlkfi/minitwit

0.0 0.0 0.0 31 KB

Dockerized, SpringBoot conversion of MiniTwit, a Twitter clone using Spark (Java), Spring, Freemarker, and HSQLDB.

License: MIT License

Java 78.68% CSS 7.41% FreeMarker 9.18% Shell 4.74%

minitwit's Introduction

MiniTwit

Dockerized, SpringBoot conversion of MiniTwit, a Twitter clone using Spark (Java), Spring, Freemarker, and HSQLDB.

New features in karlkfi/minitwit:

  • Spring Boot
    • Enhanced ServerProperties config (env var, yaml, etc)
    • Executable jar
    • Logback logging, instead of slf4j-simple
  • Docker container image

Prerequisites

  • Docker (container image includes all application dependencies)

Build

  1. Clone the repository and go to the root directory.

    git clone [email protected]:karlkfi/minitwit.git
    cd minitwit
    
  2. Build the docker image

    docker build -t karlkfi/minitwit .
    

Usage

  1. Run the docker image in the background

    docker run -d --name minitwit karlkfi/minitwit
    
  2. Find the docker container's IP

    MINITWIT_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' minitwit)
    
  3. Open MiniTwit in your browser

    http://${MINITWIT_IP}:${SERVER_PORT}/
    
  4. Sign up as a new user

    If your e-mail address has an associated Gravatar image, this will be used as your profile image.

  5. Log in

    Use the credentials created in the previous step to log in.

  6. Post a message

  7. See your message added to the timeline

Configuration

There are several ways to configure MiniTwit using Spring's ServerProperties, but only a few of them are being mapped to SparkJava.

The following environment variables can be passed to MiniTwit through Docker using environment variables:

Name Type Default Description
SERVER_PORT Integer 80 Port on which the server will listen
SPRING_DATASOURCE_URL String jdbc:hsqldb: JDBC path to the database
SPRING_DATASOURCE_USERNAME String jdbc:hsqldb: Database username
SPRING_DATASOURCE_PASSWORD String <null> Database password
SPRING_DATASOURCE_DRIVER-CLASS-NAME String <auto-detect> JDBC Driver class
SPRING_DATASOURCE_PLATFORM String hsqldb Name of the platform-specific schema to use (hsqldb or mysql)

Databases

By default, MiniTwit uses HyperSQL as an in-memory database.

For persistent storage, use MySQL.

Example MySQL Docker Deployment

# create mysql environment file
cat > mysql.env << EOF
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=minitwit
MYSQL_USER=minitwit
MYSQL_PASSWORD=minitwit
EOF

# start mysql server
docker run -d --name=mysql --env-file=mysql.env mysql:5.7.15

# find mysql IP
MYSQL_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' mysql)

# create minitwit environment file
cat > minitwit.env << EOF
SPRING_DATASOURCE_URL=jdbc:mysql://${MYSQL_IP}:3306/minitwit?autoReconnect=true&useSSL=false
SPRING_DATASOURCE_USERNAME=minitwit
SPRING_DATASOURCE_PASSWORD=minitwit
SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.cj.jdbc.Driver
SPRING_DATASOURCE_PLATFORM=mysql
EOF

# start minitwit server
docker run -d --name minitwit --env-file=minitwit.env karlkfi/minitwit

##License MIT License

See LICENSE for details.

minitwit's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.