Skip to content

andy3471/keyshare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keyshare

GitHub Workflow Status Docker Pulls

Keyshare allows you to share any extra video game key codes that you have left over with your Game Groups.

Currently, keyshare can be self hosted for one group. Users can sign in with a local account, or sign in via steam. They can then add keys for games, which can then be claimed by other users

ScreenShot Try Out the Demo

Technologies

Built on the Laravel PHP Framework, with Vue JS.

All development environments are running MySQL, Redis and Nginx. Laravel offers support for other DB and web servers, however these are untested.

Install

We recommend installing Keyshare using Docker and Docker-compose. Please see the below example docker-compose file:

version: '3'
services:
  keyshare-web:
    image: andy3471/keyshare
    restart: unless-stopped
    container_name: keyshare-web
    ports:
     - "3472:80"
    environment:
     APP_NAME: KeyshareDemo
     APP_KEY: base64:Hsn2BwXdpKHhEiTSDkkuWP1OwbfcZZFQlLoWbjY4lk8=
     STEAM_LOGIN: false
     STEAM_API_KEY: 12345
     APP_URL: https://360nohope.co.uk
     ASSET_URL: https://360nohope.co.uk
     DB_HOST: keyshare-db
     DB_DATABASE: keyshare
     DB_USERNAME: keyshare
     DB_PASSWORD: secret
     REDIS_HOST: keyshare-redis
     TWITCH_API_ENABLED: 'true'
     TWITCH_CLIENT_ID: - GET THIS FROM These are the credentials you got from https://dev.twitch.tv/console/apps -
     TWITCH_CLIENT_SECRET:  - GET THIS FROM These are the credentials you got from https://dev.twitch.tv/console/apps -
     TWITCH_UPDATE_FREQ: 180
     TWITCH_CACHE_LIFETIME: 3600
     DLC_ENABLED: 'false'
     DISCORD_ENABLED: 'false'
     DISCORD_TOKEN: - Get from https://discord.com/developers/applications
     DISCORD_CHANNEL: - Get from discord application
    AUTO_APPROVE_USERS: 0
    volumes:
      - ./web/logs:/app/storage/logs
      - ./web/app:/app/storage/app
    depends_on:
      - keyshare-db
      - keyshare-redis
  keyshare-db:
    image: mysql:5.7.30
    restart: unless-stopped
    container_name: keyshare-db
    environment:
     MYSQL_DATABASE: homestead
     MYSQL_USER: homestead
     MYSQL_PASSWORD: secret
     MYSQL_ROOT_PASSWORD: secret
  keyshare-redis:
    image: redis:6.0.4
    container_name: keyshare-redis
    restart: unless-stopped
    entrypoint: redis-server --appendonly yes

Once you have saved this docker-compose file, and run it, you should see the website on localhost:3472. Then register as a normal user, and run:

docker-compose exec keyshare-web php artisan admin:make your@email.com

Sign out and back in, and you should now be an admin.

Configuration

The below are all the environment variables that can be passed to the docker-compose file:

Variable Description
APP_NAME Title of the website
APP_ENV Environment being run on, can be set to local for test environments
APP_KEY Unique base64 string. Run sudo docker run -e "CONTAINER_ROLE=keygen" -e "APP_ENV=local" andy3471/keyshare to generate one, and paste it in.
APP_DEBUG Enables debug logging
APP_URL External URL you will access the site from
ASSET_URL External URL that assets are loaded from
AUTO_APPROVE_USERS Boolean value, Whether anyone can sign up for the site, or they require an admin to authorise them
STEAM_LOGIN Boolean value, enabled steam login
STEAM_API_KEY API key for steam login, generated on https://steamcommunity.com/dev/apikey
TWITCH_API_ENABLED Enabled/Disables the external twitch API for game lookups
TWITCH_CLIENT_ID If twitch API is enabled, you'll need to supply this. These are the credentials you got from https://dev.twitch.tv/console/apps
TWITCH_CLIENT_SECRET Secret to match above ID
TWITCH_UPDATE_FREQ How many days should a game exist, before we pull the data from Twitch IGDB again
TWITCH_CACHE_LIFETIME For how long should we cache twitch API requests
DISCORD_ENABLED Enables a discord bot.
DISCORD_TOKEN Get a dfiscord bot and client ID from https://discord.com/developers/applications
DISCORD_CHANNEL The channel that it should post to. Enable developer mode on discord, right click the channel and copy the ID.
DLC_ENABLED Enabled DLC feature (Recommended is off if you are using Twitch IGDB)
DB_HOST MySQL host, usually the container name of the SQL server
DB_PORT Defaults to 3306, only override if you're using your own DB server
DB_DATABASE Name of the database
DB_USERNAME Username for the DB
DB_PASSWORD Password for the DB user
REDIS_HOST Hostname of the redis container
REDIS_PASSWORD Only use if you're using a password protected redis instance
REDIS_PORT Port of redis, defualts to 6379, so don't change it unless you're running your own redis instance on a different port
MAIL_HOST SMTP host
MAIL_PORT SMTP Port
MAIL_USERNAME Email Username
MAIL_PASSWORD Email Pasword
MAIL_ENCRYPTION can be set to SSL or TLS, if your mail server requires it.
MAIL_FROM_NAME Name that emails appear to be sent from.

You can override the logo by adding the following volume bind, and creating a file called logo.png locally, in the docker-compose folder.:

- ./logo.png:/app/public/images/logo_override.png

Karma is calculated and stored in redis, if you ever have desync issues, you can run the following to recalculate it:

docker-compose exec keyshare-web php artisan karma:generate

Reverse Proxy

You can run the site behind an NGINX reverse proxy, using a config like:

server {
    server_name 360nohope.co.uk www.360nohope.co.uk;

    location / {
        proxy_pass http://ip:port;
        proxy_set_header Host 360nohope.co.uk
        proxy_set_header X-Forwarded-Proto https;
    }
}

Manual Install

Manual Install Guide
Configuration

Contributing

Setting up a dev environment
Debugging
Contribution guidelines