dingwen07 / VTHacks11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VTHacks11 - Chatroom

Latest tag GitHub repo size GitHub last commit GitHub Language GitHub License

Description

A temporary online groupchat platform. This repository contains the backend server. The frontend is located at dingwen07/VTHacks11-Frontend.

Build

  1. Clone the repository
  2. Run mvn clean package to build and package the backend server

Deploy

Backend Server

Run java -jar target/chatroom-0.0.1-SNAPSHOT.jar to run the backend server. It will listen on port 8080.

Redis

Start a Redis server, if your redis server is not running on localhost:6379, you can change the configuration in chatroom/src/main/java/com/example/chatroom/config/RedissionConfig.java and rebuild. If you would like to use containers, make sure the server can access the redis server.

Reverse Proxy

Use Nginx to reverse proxy the backend server and serve the frontend files. Here is an example configuration:

server {
    listen 0.0.0.0:8000;
    listen [::]:8000;
    server_name example.com;

    location / {
        return 301 $scheme://$host:$server_port/web/;
    }

    location /web/ {
        alias /var/www/chatroom/; # The path to the frontend files
        try_files $uri $uri/ =404;
    }

    location /api/v1/ {
        proxy_pass http://localhost:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Make sure Nginx can accees to the exposed port of the backend server.

About

License:GNU Affero General Public License v3.0


Languages

Language:Java 98.3%Language:Python 1.7%