Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
Merge branch 'dev' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
schnapster committed Nov 15, 2017
2 parents d838b13 + 0a4519e commit 78a63da
Show file tree
Hide file tree
Showing 104 changed files with 1,432 additions and 873 deletions.
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Bootloader/bootloader.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"command": [
"java",
"-jar",
"-Xmx128m",
"-Xmx128m",
"FredBoat.jar"
],
"jarName": "FredBoat.jar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static Process boot() throws IOException {

if (recentBoots >= 4) {
System.out.println("[BOOTLOADER] Failed to restart 3 times, probably due to login errors. Exiting...");
System.exit(-1);
System.exit(ExitCodes.EXIT_CODE_ERROR);
}

//ProcessBuilder pb = new ProcessBuilder(System.getProperty("java.home") + "/bin/java -jar "+new File("FredBoat-1.0.jar").getAbsolutePath())
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributing
FredBoat is built using Gradle, so you should just be able to import the project in your favorite IDE and download all dependencies while building. Check out the [issues](https://github.com/Frederikam/FredBoat/issues) to find out what needs to be done.

When submitting a pull request, please submit against the `development` branch, or you will have to reopen your PR.
When submitting a pull request, please submit against the `dev` branch, or you will have to reopen your PR.

## Code conventions
Code is indented with 4 spaces and without brackets on newlines. Please use the logging system (SLF4J) instead of `System.out` or `System.err`.
Expand Down
5 changes: 5 additions & 0 deletions FredBoat/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**
#ignore everything except the following files, they are used in the Dockerfile to build the fredboat image
!Dockerfile
!FredBoat.jar
!config.yaml
14 changes: 14 additions & 0 deletions FredBoat/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM openjdk:8-jre-alpine

ENV ENV docker

RUN mkdir /opt
RUN mkdir /opt/FredBoat

COPY config.yaml /opt/FredBoat/config.yaml
COPY FredBoat.jar /opt/FredBoat/FredBoat.jar

EXPOSE 1356

WORKDIR /opt/FredBoat
ENTRYPOINT ["java", "-jar", "-Xmx128m", "FredBoat.jar"]
23 changes: 16 additions & 7 deletions FredBoat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ ext {

shadowJar {
archiveName = "FredBoat.jar"
doLast {
//copies the jar into a place where the Dockerfile can find it easily (and users maybe too)
copy {
from 'build/libs/FredBoat.jar'
into '.'
}
}
}

dependencies {
compile project(':Shared')
compile group: 'net.dv8tion', name: 'JDA', version: '3.3.1_300'
compile group: 'com.sedmelluq', name: 'lavaplayer', version: '1.2.44'
compile group: 'com.github.FredBoat', name: 'lavaplayer', version: '1.2.44.2-FredBoat'
compile group: 'com.github.FredBoat', name: 'jda-nas', version: '1.0.5.1-JDA'

if (System.getenv('dev') == 'true') {
Expand Down Expand Up @@ -79,10 +86,12 @@ import org.apache.tools.ant.filters.ReplaceTokens

processResources {
//inject values into app.properties
filter ReplaceTokens, tokens: [
"project.version" : project.version,
"project.groupId" : project.group,
"project.artifactId": project.ext.moduleName,
"env.BUILD_NUMBER" : (System.getenv('CI') ? System.getenv('BUILD_NUMBER') : 'DEV')
]
filesMatching("**/*.properties") {
filter ReplaceTokens, tokens: [
"project.version" : project.version,
"project.groupId" : project.group,
"project.artifactId": project.ext.moduleName,
"env.BUILD_NUMBER" : (System.getenv('CI') ? System.getenv('BUILD_NUMBER') : 'DEV')
]
}
}
3 changes: 3 additions & 0 deletions FredBoat/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ restServerEnabled: true # Set this to false if you are running multiple F
admins: [] # Add comma separated userIds and roleIds that should have access to bot admin commands
useAutoBlacklist: true # Set to true to automatically blacklist users who frequently hit the rate limits
game: "" # Set the displayed game/status. Leave empty quote marks for the default status
continuePlayback: false # Set to true to force the player to continue playback even if left alone

enableYouTube: true # Set to true to enable playing YouTube links
enableSoundCloud: true # Set to true to enable playing SoundCloud links
Expand All @@ -16,3 +17,5 @@ enableMixer: true # Set to true to enable playing Mixer links
enableSpotify: true # Set to true to enable playing Spotify links
enableHttp: true # Set to true to enable playing direct links

# THIS IS TEMPORARY UNTIL COMMANDS ARE MODULARIZED
tempUseVoiceChannelCleanup: true # This acts as an override if set to false no vcCleanupAgent will be run
3 changes: 2 additions & 1 deletion FredBoat/credentials.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

token: # Add your discord bot token below to the beta and patron slots, between the quotation marks
# Find the token of your bot on https://discordapp.com/developers/applications/me
# Tutorial: https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token
beta: "PutYourDiscordBotTokenHere"
patron: "PutYourDiscordBotTokenHere"

Expand Down Expand Up @@ -93,6 +94,6 @@ sentryDsn:
# eventLogWebhookId:
# eventLogWebhookToken:

# post mvn test results into a discord channel. the token must be discord bot token
# post build tool test results into a discord channel. the token must be discord bot token
testToken:
testChannelId:
85 changes: 85 additions & 0 deletions FredBoat/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

################################################################################
### Running FredBoat with docker-compose
################################################################################
###
### Use a proper text editor like Sublime when editing this file
### Do not use tab characters in this file, only spaces are allowed. Don't add or delete unnecessary spaces.
### More information on correctly formatting yaml files: http://www.yaml.org/start.html
###
### For further information on running FredBoat visit https://fredboat.com/docs/selfhosting or the #selfhosting channel
### on the FredBoat Hangout Discord server: https://discord.gg/cgPFW4q


### NOTE: This file builds the docker images from scratch. The means it will only work properly in a checkout out git
### repo with built jar files. If you don't know what that is or how that works, use the docker-compose file in the root
### directory above this one, which will download pre-built docker images from the official docker hub.



version: '3'
services:

################################################################################
## Database
################################################################################
db:
build: ./docker/database/
restart: on-failure:3

# WINDOWS ONLY: if you are running under windows you need to comment out the following two lines:
volumes:
- ./postgres-data:/var/lib/postgresql/data

# WINDOWS ONLY: if you are running under windows and want to take manual backups of the database
# via a docker volume, uncomment the following two lines and read the snippet at the bottom of this file
#volumes:
#- postgres-data-volume:/var/lib/postgresql/data


################################################################################
## FredBoat
################################################################################
bot:
build: .
restart: on-failure:3
depends_on:
- db
ports:
- 1356:1356
volumes:
- ./config.yaml:/opt/FredBoat/config.yaml
- ./credentials.yaml:/opt/FredBoat/credentials.yaml
- ./logs:/opt/FredBoat/logs
- ./music_persistence:/opt/FredBoat/music_persistence
# Need a bigger memory size or any other custom JVM args? uncomment and edit the line below accordingly
#entrypoint: java -jar -Xmx128m FredBoat.jar


################################################################################
## Automatic updates
################################################################################
# if you want automatic updates, uncomment the lines below

#watchtower:
# image: v2tec/watchtower
# restart: on-failure:3
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
# command: --cleanup --interval 300 #seconds


################################################################################
## Windows stuff
################################################################################

# WINDOWS ONLY: If you are running on Windows and want to be able to backup the postgres data volume, run
#
# docker volume create --name postgres-data-volume -d local
#
# and uncomment the following lines:
# See also the WINDOWS ONLY hints in the database section

#volumes:
# postgres-data-volume:
# external: true
5 changes: 5 additions & 0 deletions FredBoat/docker/database/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM postgres:10.0
ENV POSTGRES_USER fredboat
COPY postgres-healthcheck.sh /usr/local/bin/
COPY initdb.sh /docker-entrypoint-initdb.d/
HEALTHCHECK CMD ["postgres-healthcheck.sh"]
5 changes: 5 additions & 0 deletions FredBoat/docker/database/initdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "postgres" -d fredboat -c "CREATE EXTENSION hstore;"
psql -v ON_ERROR_STOP=1 --username "postgres" -d fredboat -c "CREATE EXTENSION pg_trgm;"
21 changes: 21 additions & 0 deletions FredBoat/docker/database/postgres-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -eo pipefail

host="$(hostname -i || echo '127.0.0.1')"
user="${POSTGRES_USER:-postgres}"
db="${POSTGRES_DB:-$POSTGRES_USER}"
export PGPASSWORD="${POSTGRES_PASSWORD:-}"

args=(
# force postgres to not use the local unix socket (test "external" connectibility)
--host "$host"
--username "$user"
--dbname "$db"
--quiet --no-align --tuples-only
)

if select="$(echo 'SELECT 1' | psql "${args[@]}")" && [ "$select" = '1' ]; then
exit 0
fi

exit 1
Loading

0 comments on commit 78a63da

Please sign in to comment.