Giter Site home page Giter Site logo

systemz / aimpanel2-exp Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 1.52 MB

Never released, incomplete project with game hosting panel powered by Go in master-slave architecture

Dockerfile 0.34% Shell 3.06% Go 70.54% JavaScript 0.78% HTML 0.56% Vue 22.27% TypeScript 2.44%

aimpanel2-exp's Introduction

Aimpanel v2

The most easy to use game panel as a service

Dev launch

If your setup is ready...

Full auto

Just install tmux and run ./Taskfile.sh up.

Manual

Run MongoDB and web interface for it (PMA like)

docker-compose up

Run frontend in WebStorm, then visit http://127.0.0.1:8080

./Taskfile.sh frontend
# preferably in WebStorm

Run VM for slave

vagrant up
vagrant ssh
sudo -i

Dev deployment

First time? We got you covered :)

Frontend

Remember to open master-frontend/tslint.json with IntelliJ and apply rules to automatic formatting in popup!

./Taskfile.sh frontend

Backend

Dependencies

apt-get install tmux libsystemd-dev inotify-tools

ENV variables

You need to build and run master binary with something like this to make it work locally:

DEV_MODE=true
HTTP_FRONTEND_DIR=/home/user/Projects/aimpanel2/master-frontend/dist/
HTTP_DOCS_DIR=/home/user/Projects/aimpanel2/master/
HTTP_TLS_KEY_PATH=/home/user/Projects/aimpanel2/key.pem
HTTP_TLS_CERT_PATH=/home/user/Projects/aimpanel2/crt.pem
HTTP_TEMPLATE_DIR=/home/user/Projects/aimpanel2/master/templates/

Example cmd:

cd master
DEV_MODE=true HTTP_TEMPLATE_DIR=./templates/ HTTP_TLS_KEY_PATH=../key.pem HTTP_TLS_CERT_PATH=../crt.pem go run . server 3000

Cert

Generate TLS cert for local dev env. Remember to visit https://127.0.0.1:3000 and accept self signed cert in a browser at least once. If you don't do this, visiting frontend via webpack server will not work.

# generate private key and self signed TLS certificate
./Taskfile.sh dev-tls-crt
# show generated cert and key
ls -alh *.pem

# use local TLS cert fingerprint to whitelist slave connection to master
openssl x509 -noout -in crt.pem -fingerprint -sha256

# get remote TLS cert fingerprint
# https://askubuntu.com/questions/156620/how-to-verify-the-ssl-fingerprint-by-command-line-wget-curl
echo | openssl s_client -connect example.com:443 |& openssl x509 -fingerprint -sha256 -noout

Code generation

If you change some iota ints or whatever, just run this to regenerate all syntax sugar:

./Taskfile.sh generate

You will need this if you encounter error like:

"invalid array index" compiler error signifies that the constant values have changed

Slave VM via Vagrant

Tested on Kubuntu 18.04

# QEMU / KVM
sudo apt-get install -y qemu libvirt-bin ebtables dnsmasq-base virt-manager
#this allows access to VMs without root, reboot to apply it
sudo adduser `id -un` libvirt-qemu

# Vagrant
#https://www.vagrantup.com/downloads.html
wget https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb
sudo dpkg -i vagrant_2.2.9_x86_64.deb
rm vagrant_2.2.9_x86_64.deb

# Vagrant KVM plugin
#https://github.com/vagrant-libvirt/vagrant-libvirt
sudo apt-get install -y libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
vagrant plugin install vagrant-libvirt

# remember to tune up Vagrantfile with resources if necessary

# Run VM
./Taskfile.sh up-slave

# Configure hosts
# if this doesn't work just put your local LAN ip in /etc/hosts like this
# 192.168.X.XXX aimpanel.local
./Taskfile.sh update-hosts-slave

# Access via SSH
vagrant ssh

# run this in VM as root to deploy slave
wget --no-check-certificate https://aimpanel.local:3000/i/<HOST TOKEN> -O- | bash -

# WIP
# Apply changes to install.sh (token change etc)
#vagrant provision

# if you are developing slave, use this to sync binary on VM
./Taskfile.sh sync-slave
# or this to auto build, sync and restart slave on VM on slave/* files change
./Taskfile.sh sync-slave-auto

Destroy VM

vagrant destroy -f

Git tips

Clean old and removed remote branches in local repo

git remote prune origin

Swagger

Swagger allow us to automatically build API docs and client SDK in the future, all this without much work from devs

go get -u github.com/swaggo/swag/cmd/swag

Generate for local purpose

This will generate .json file with swagger spec

./Taskfile.sh swagger-gen-dev

Self-signed cert for file server

This will generate self signed cert for slave. Remember to set IP on host page in frontend.

./Taskfile.sh dev-slave-crt

Serve

This will serve UI for generated swagger spec

./Taskfile.sh swagger-serve

Slave

Redis debug

redis-cli -s /opt/aimpanel/redis/redis.sock

Diagnostics

ldd --version | grep ldd --color=never

aimpanel2-exp's People

Contributors

kacpersaw avatar systemz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.