Skip to content
This repository was archived by the owner on Oct 29, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ config/config.local.php
/config/*.pem
/config/*.csr

/data/mysql
/data/redis

/public/*.txt
/public/files
/public/*.html
Expand Down
49 changes: 49 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM php:7.3-fpm

# Copy composer.lock and composer.json
COPY composer.json /var/www/

# Set working directory
WORKDIR /var/www

# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
mysql-client-* \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libzip-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd

## Redis
RUN pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Copy existing application directory contents
COPY . /var/www

# Copy existing application directory permissions
COPY --chown=www-data:www-data . /var/www

# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ See [LICENSE.md](LICENSE.md)

### Building

[docker](https://www.docker.com/) Docker

[nodejs](http://nodejs.org/) Dependency manager

[webpack](https://webpack.github.io/) Project builder
Expand All @@ -25,11 +27,18 @@ See [LICENSE.md](LICENSE.md)

## Getting Started

1. Create the configuration file `cp config/config.local.conf.example config/config.local.conf` and override anything you want to.
2. Install `docker-compose up -d`
3. Create and load the database using `docker-compose exec -T db mysql -uroot -pdgg dgg < destiny.gg.sql`
4. Load Seed Data `docker-compose exec -T db mysql -uroot -pdgg dgg < destiny.gg.data.sql`
5. Hit `http://127.0.0.1:9380` in your browser

Create the configuration file "config/config.local.php" and override what you need.

Create and load the database using `destiny.gg.sql`
### Using Docker

* You can spin down the stack with `docker-compose down`
* You can boot the stack with `docker-compose up -d`
* You can see useful nginx & php output with `docker-compose logs -f`
* You can connect to mysql with `docker-compose exec dgg_mysql mysql -pdgg dgg`

### Dependencies

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"paypal/merchant-sdk-php" : "3.12.*",
"monolog/monolog" : "1.x-dev",
"doctrine/inflector": "1.3.x-dev",
"doctrine/collections": "1.5.x-dev",
"doctrine/collections": "1.6.x-dev",
"doctrine/cache": "1.8.x-dev",
"doctrine/annotations": "1.7.x-dev",
"doctrine/common": "2.10.x-dev",
Expand All @@ -26,4 +26,4 @@
"autoload": {
"psr-0": {"Destiny":"lib/"}
}
}
}
85 changes: 85 additions & 0 deletions config/config.local.php.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php
////////////////////////
////////////////////////
/// PUBLIC INFO ONLY ///
////////////////////////
////////////////////////
return [

'support_email' => '*** INSERT YOUR EMAIL ***',
'calendar' => 'i54j4cu9pl4270asok3mqgdrhk@group.calendar.google.com',
'commerce' => ['receiver_email' => 'Steven.Bonnell.II@GMail.com'],
'embed' => ['stream' => 'https://player.twitch.tv/?channel=destiny'],
'reddit' => ['threads' => 'https://www.reddit.com/r/destiny/hot.json'],
'blog' => ['feed' => 'https://blog.destiny.gg/feed/json'],
'android' => ['app' => 'gg.destiny.app.chat'],

'twitch' => [
'id' => 18074328,
'user' => 'destiny',
],
'streamelements' => [
'dgg_user' => 10
],
'streamlabs' => [
'dgg_user' => 10
],
'twitchbroadcaster' => [
'dgg_user' => 10
],

'meta' => [
'shortName' => 'Destiny.gg',
'title' => 'Destiny - Steven Bonnell II',
'domain' => 'www.destiny.gg',
'author' => 'Steven Bonnell II',
'description' => 'Steven (Destiny) Bonnell II is a professional streamer, primarily playing games, but will often venture off into other topics, including but not limited to: philosophy, youtube videos, music and all sorts of wonderful pseudo-intellectualism.',
'keywords' => 'Steven Bonnell,Destiny,Destiny.gg,StarCraft,StarCraft2,Counter Strike,CS:GO,League of Legends,Hearth Stone,streamer,stream,game,pc,build a box,twitch,tv,twitch.tv',
'video' => 'http://www-cdn.jtvnw.net/widgets/live_facebook_embed_player.swf?channel=destiny',
'videoSecureUrl' => 'https://secure.jtvnw.net/widgets/live_facebook_embed_player.swf?channel=destiny',
'image' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/destiny-profile_image-951fd53950bc2f8b-300x300.png'
],

'links' => [
'/ting' => 'https://ting.7eer.net/c/72409/87559/2020',
'/eve' => 'https://secure.eveonline.com/trial/?invc=7a8cfcda-5915-4297-9cf9-ed898d984ff2&action=buddy',
'/schedule' => 'https://www.google.com/calendar/embed?src=i54j4cu9pl4270asok3mqgdrhk%40group.calendar.google.com',
'/shirt' => 'https://www.designbyhumans.com/shop/Destiny/',
'/forge' => 'https://bit.ly/ForgeDestiny',
'/facebook' => 'https://www.facebook.com/OmniDestiny',
'/youtube' => 'https://www.youtube.com/user/Destiny',
'/reddit' => 'https://www.reddit.com/r/Destiny',
'/github' => 'https://github.com/destinygg',
'/twitch' => 'https://www.twitch.tv/destiny',
'/lastfm' => 'http://www.last.fm/user/StevenBonnellII',
'/donate' => 'https://www.twitchalerts.com/donate/destiny',
'/blog' => 'http://blog.destiny.gg',
'/loot' => 'https://loots.com/destiny',
'/loots' => 'https://loots.com/destiny',
'/chair' => 'http://www.4gamergear.com#oid=1027_1',
'/amazon' => 'https://www.amazon.com/shop/destiny?listId=1U7DVEENMW4U&ref=idea_share_inf',
'/gmg' => 'https://www.greenmangaming.com/?tap_a=1964-996bbb&tap_s=55177-fd1979',
'/greenmangaming' => 'https://www.greenmangaming.com/?tap_a=1964-996bbb&tap_s=55177-fd1979',
'/instagram' => 'https://www.instagram.com/destiny/',
'/podcast' => 'https://destiny.libsyn.com/',
'/podcastrss' => 'https://destiny.libsyn.com/rss',
'/shop' => 'https://www.designbyhumans.com/shop/Destiny',
'/discord' => 'https://discordapp.com/invite/destiny',
],

'redis' => [
'host' => 'dgg_redis',
],

'db' => [
'host' => 'dgg_mysql',
'dbname' => 'dgg',
'user' => 'root',
'password' => 'dgg',
],

'cdn' => [
'domain' => '127.0.0.1:9880',
'protocol' => 'http://'
],
];
3 changes: 3 additions & 0 deletions config/local.mysql.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[mysqld]
general_log = 1
general_log_file = /var/lib/mysql/general.log
7 changes: 7 additions & 0 deletions config/local.php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
upload_max_filesize=40M
post_max_size=40M

log_errors = on
display_errors = off
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
error_log = /var/log/error.log
26 changes: 13 additions & 13 deletions config/manifest.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
// auto-generated: 1573074899501
// auto-generated: 1579154717888
return [
"common.vendor.js" => "common.vendor.a180bcf84872f6b5b06c.js",
"runtime.js" => "runtime.f820323d7f69fc9aac27.js",
"chat.vendor.css" => "chat.vendor.921603439ba1b85e5c7b.css",
"chat.vendor.js" => "chat.vendor.b8a1ff790976d978fa47.js",
"admin.js" => "admin.ff5a37819698288553df.js",
"bigscreen.js" => "bigscreen.ed9caa26b60c54b64521.js",
"chat.js" => "chat.81ec13ebf502ab19b8fd.js",
"profile.js" => "profile.de314aa1ff7e45d8b073.js",
"streamchat.js" => "streamchat.435bdb77c1f249e56b82.js",
"votechat.js" => "votechat.8011db95d14764c04653.js",
"web.css" => "web.44a3fca3a7cf0c30f49b.css",
"web.js" => "web.72821aa16bb1adf7c9d1.js",
"common.vendor.js" => "common.vendor.577ea20b04af95464fb9.js",
"runtime.js" => "runtime.60aabece63b63766f770.js",
"chat.vendor.css" => "chat.vendor.010a03adb03b4b1c96c6.css",
"chat.vendor.js" => "chat.vendor.32a21117ec538f592a5a.js",
"admin.js" => "admin.9fc5b6e9bfd006201b92.js",
"bigscreen.js" => "bigscreen.3d4fff2acef5a2bb6394.js",
"chat.js" => "chat.54838c41c1e57dfefc3f.js",
"profile.js" => "profile.1920d4ed83f2244fb9e0.js",
"streamchat.js" => "streamchat.fc6a61bd6f9b041e4a70.js",
"votechat.js" => "votechat.d2c2c05a6ca0bd568699.js",
"web.css" => "web.8bebfff54dde79230dda.css",
"web.js" => "web.3d80f8efc87e3264a92f.js",
"font/style.scss" => "font/fa-solid-900.woff2",
"img/style.scss" => "img/sl-logo.png"
];
42 changes: 42 additions & 0 deletions config/nginx/local/dgg.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
server {
listen 80;
server_name www.destiny.gg 127.0.0.1;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/public;

location ~ ^/\. { deny all; }
location /n/ {
rewrite ^(.*) "https://blog.destiny.gg/$1" permanent;
}
location /n {
rewrite .* "https://blog.destiny.gg/" permanent;
}

location ~* \.(jpg|jpeg|png|gif|ico|css|js|map|svg)$ {
expires 365d;
}

location ~ \.php$ {
if ($request_uri !~ "^/embed") {
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
}

add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=2700000; includeSubDomains; preload";

try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass dgg_php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}

location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
15 changes: 15 additions & 0 deletions config/nginx/local/dgg_cdn.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen 8080;
server_name devcdn.destiny.gg 127.0.0.1;
root /var/www/static/;

rewrite ^/\d+\.\d+\.\d+/(.*)$ /$1;
location ~ ^/\. { deny all; }
location ~* \.(jpg|jpeg|png|gif|ico|css|js|map|svg)$ {
expires 365d;
}

location / {
rewrite .* "http://localhost:9380";
}
}
2 changes: 2 additions & 0 deletions data/mysql/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions data/redis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
75 changes: 75 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
version: '3'
services:

#PHP Service
dgg_php:
build:
context: .
dockerfile: Dockerfile
container_name: dgg_php
restart: unless-stopped
tty: true
working_dir: /var/www
volumes:
- ./:/var/www
- ./config/local.php.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- dgg-network

#Nginx Service
dgg_web:
image: nginx:alpine
container_name: dgg_web
restart: unless-stopped
tty: true
ports:
- "9380:80" # website
- "9880:8080" # cdn
volumes:
- ./:/var/www
- ./config/nginx/local/:/etc/nginx/conf.d/
networks:
- dgg-network

#MySQL Service
dgg_mysql:
image: mysql:5.7.22
container_name: dgg_mysql
restart: unless-stopped
tty: true
ports:
- "9306:3306"
environment:
MYSQL_DATABASE: dgg
MYSQL_ROOT_PASSWORD: dgg
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdatamysql:/var/lib/mysql/
- ./config/local.mysql.cnf:/etc/mysql/my.cnf
networks:
- dgg-network

#Redis Service
dgg_redis:
container_name: dgg_redis
image: redis
ports:
- "9379:6379"
volumes:
- dbdataredis:/data
restart: always
networks:
- dgg-network

#Docker Networks
networks:
dgg-network:
driver: bridge

#Volumes
volumes:
dbdatamysql:
driver: local
dbdataredis:
driver: local
2 changes: 1 addition & 1 deletion lib/boot.app.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Monolog\Logger;
use Monolog\Processor\PsrLogMessageProcessor;

define('_APP_VERSION', '2.13.0'); // auto-generated: 1573074900222
define('_APP_VERSION', '2.13.0'); // auto-generated: 1579154719013
define('_BASEDIR', realpath(__DIR__ . '/../'));

$loader = require _BASEDIR . '/vendor/autoload.php';
Expand Down
2 changes: 1 addition & 1 deletion lib/boot.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Monolog\Logger;
use Monolog\Processor\PsrLogMessageProcessor;

define('_APP_VERSION', '2.13.0'); // auto-generated: 1573074900226
define('_APP_VERSION', '2.13.0'); // auto-generated: 1579154719017
define('_BASEDIR', realpath(__DIR__ . '/../'));

$loader = require _BASEDIR . '/vendor/autoload.php';
Expand Down
Loading