Skip to content

TTNRT/ttpages-server

Repository files navigation

TTPages Web Server

A simple way to get your static pages running from your Gitea instance!

Requirements

You should have following that is needed for the server to function!

  • A token from your Gitea instance
  • Your Gitea instance URL
  • Docker and Docker compose (if doing the docker method)
  • A web server that can proxy ports
  • cmake and Golang (if doing the standalone method)
  • A domain for your pages to be listened on

Get started

There is two ways on setting up the web server. You can do it from Docker or by building the program itself!

Docker method

To start off, let's build the docker image using the provided Makefile in the repository! Type the following command below to build it!

make image

Once you have the image built, you should decide on how you should run it. You can run it from the command line, or using the provided docker compose file in the repository! Remember to set the port environment variable before you start the server! Below is an example on setting it in the compose file.

environment:
    # You may change this to any port that is available on your server!
    - PORT=8000
ports:
    # Have the port variable set first!
    - "${PORT}:${PORT}"

Once that is done, you are ready to start the server! Run this command below to do so!

# If not on root user
sudo docker compose up -d

# If on the root user
docker compose up -d

Standalone method

To start off, you need to build the program from it's source code. You should already have the latest version of cmake and goLang on your server! If not, Google on how to install them! Type this command below to build it.

make build

Once you have it built, you need to decide on how your going to run it. The easiest way of doing this is using the systemd daemon! There is service file provided here.

Warning

Before doing this, you need to have root access to the /etc/systemd/system and /usr/local/binfolders as that allows the server run when the system starts up! Do not put this in your user systemd or bin folders!

[!INFO]

Remember to modify the service file so you can add your port variable!

First off, let's copy the provided service file to the systemd folder. The command below shows how to do this.

# If not on the root user
sudo cp ttpagessrv.service /etc/systemd/system

# If on the root user
cp ttpagessrv.service /etc/systemd/system

You should also copy the compiled program to the bin folder. Use the command below to do so.

# If not on the root user
sudo cp ttpages-server /usr/local/bin

# If on the root user
cp ttpages-server /usr/local/bin

Make sure to set it as executable as well!

# If not on the root user
sudo chmod /usr/local/bin/ttpages-server +x

# If on the root user
chmod /usr/local/bin/ttpages-server +x

Once you have the files copied, go into the systemd folder you copied the service to. We need to modify it a bit. You may use any text editor you like. Below is what should be added or replaced in the file.

[Service]
User=root
Environment=DOMAIN=<A DOMAIN FOR HOW YOUR PAGES SHOULD LISTENED ON>
Environment=GITEA_URL=<YOUR GITEA INSTANCE URL>
Environment=GITEA_TOKEN=<TOKEN THAT YOU MADE IN YOUR GITEA INSTANCE>

After that, you should enable the service and start it up. Run these commands to do so.

sudo systemctl enable ttpagessrv
sudo systemctl start ttpagessrv

Web server setup

Once you have your pages server running, you are ready to proxy it to your web server. We recommend using nginx since it's more stable and easy to use. You can use other web servers if they have a proxy feature in them.

Notes

Some parts of the source code was from here and other sources.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published