Skip to content

levg34/beammp-admin

Repository files navigation

BeamMP admin

Web interface for BeamMP server

.github/workflows/main.yml

Now complete with log rotate, saving users from rotated logs to database, uploading and deleting mods, config switching and much more! Feature flipping comming soon.

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Installation

Requirements

You need one or two linux server / VPS / Raspberrypi (Debian 10+, Ubuntu 18+, Raspbian)

You can also deploy this admin app on Vercel.

You need nodejs version 12 or greater.

Install BeamMP server on a linux server

You can find the procedure here.

The recommended way if you have an ubuntu server is to download the latest binary for ubuntu on BeamMP-Server GitHub release page

You must set it up in a beammp-server folder at the root of the folder of the user which will launch BeamMP server.

Install the admin app on the same server or another linux server

  • Clone this repository:
git clone https://github.com/levg34/beammp-admin.git
  • Install node libraries:
cd beammp-admin
npm install
  • Build the project
npm run build
  • Create your config:

Create a .env.local file in beammp-admin folder root with the following content:

HOST=193.201.31.49                       # replace with your beamMP server IP adress
USERNAME=youruser                        # replace with the username which runs BeamMP server on your remote server
PRIVATE_KEY=/home/localuser/.ssh/id_rsa  # replace with the path to your private key

If you want to change from the default locale (en-uk), add this like in your .env.local file:

NEXT_PUBLIC_LOCALE=fr                    # replace with your locale
  • Add your key to authorized ssh keys

Copy the public key from where you run this server to the remote server (where you run beammp server) in ~/.ssh/authorized_keys

cat /home/localuser/.ssh/id_rsa.pub | ssh youruser@beammpserver: -T "cat >> ~/.ssh/authorized_keys"
  • Create a directory for log rotation (feature flipping comming soon)
mkdir ~/logs
  • Start the server
npm start

⚠️ To run the server in the background indefinitely, run this command instead:

nohup npx next start &

Advanced use

Supabase (feature flipping comming soon)

If you want to use supabase to save the users between server restart, save configs, etc, you need to add the following lines in your .env.local file:

SUPABASE_URL=https://yoursupabaseurl.supabase.co  # replace with your supabase URL
SUPABASE_KEY=yoursupabasekey                      # replace with your supabase key

You need to create the following tables:

  • config: represents a ServerCOnfig.toml content, here is mine but you should be ready to adapt yours:

Table config

  • logfiles:

Table logfiles

  • users

Table user

OAuth (feature flipping comming soon)

To be able to authenticate users, you need to create an OAuth app in GitHub and/or Google, and add the following to your .env.local file:

NEXTAUTH_SECRET=createasupercomplicatedsecretlocally

GITHUB_ID=githubappid
GITHUB_SECRET=githubsecret

GOOGLE_CLIENT_ID=googleclientid
GOOGLE_CLIENT_SECRET=googleclientsecret

Then define which users can use your app by creating config/usersConfig.json based on config/usersConfig.example.json:

{
    "admins": [
        "[email protected]",
        "[email protected]"
    ]
}

⚠️ For security reasons, you need to rebuild the project after changing this file.

More

I will try to keep this readme up to date, but I add so much new features, that it may not be up to date when you read it.

License

This project is under the GNU v3 licence (see LICENSE.md file)

Releases

No releases published

Packages

No packages published

Languages