forked from bigbluebutton/bigbluebutton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add redis password to akka-transcode
- Loading branch information
Showing
4 changed files
with
102 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 14 additions & 2 deletions
16
akka-bbb-transcode/src/main/scala/org/bigbluebutton/SystemConfiguration.scala
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
package org.bigbluebutton | ||
|
||
import scala.util.Try | ||
import com.typesafe.config.ConfigFactory | ||
|
||
import org.bigbluebutton.common2.redis.RedisConfiguration | ||
trait SystemConfiguration { | ||
val config = ConfigFactory.load() | ||
|
||
// Redis server configuration | ||
lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") | ||
lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) | ||
lazy val redisPassword = Try(config.getString("redis.password")).getOrElse("") | ||
lazy val redisExpireKey = Try(config.getInt("redis.keyExpiry")).getOrElse(1209600) | ||
|
||
trait SystemConfiguration extends RedisConfiguration { | ||
lazy val _ffmpegPath = Try(config.getString("transcoder.ffmpeg-path")).getOrElse("/usr/local/bin/ffmpeg") | ||
lazy val _ffprobePath = Try(config.getString("transcoder.ffprobe-path")).getOrElse("/usr/local/bin/ffprobe") | ||
|
||
lazy val _videoconfLogoImagePath = Try(config.getString("videoconference.videoconf-logo-image-path")).getOrElse("") | ||
lazy val _enableUserVideoSubtitle = Try(config.getString("videoconference.enable-user-video-subtitle").toBoolean).getOrElse(false) | ||
lazy val _sipVideoResolution = Try(config.getString("videoconference.sip-video-resolution")).getOrElse("") | ||
|
||
lazy val toAkkaTranscodeRedisChannel = Try(config.getString("redis.toAkkaTranscodeRedisChannel")).getOrElse("bigbluebutton:to-bbb-transcode:system") | ||
lazy val fromAkkaTranscodeRedisChannel = Try(config.getString("redis.fromAkkaTranscodeRedisChannel")).getOrElse("bigbluebutton:from-bbb-transcode:system") | ||
lazy val toAkkaTranscodeJsonChannel = Try(config.getString("eventBus.toAkkaTranscodeJsonChannel")).getOrElse("to-akka-transcode-json-channel") | ||
lazy val fromAkkaTranscodeJsonChannel = Try(config.getString("eventBus.fromAkkaTranscodeJsonChannel")).getOrElse("from-akka-transcode-json-channel") | ||
} |
111 changes: 63 additions & 48 deletions
111
...-transcode/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,63 @@ | ||
package org.bigbluebutton.endpoint.redis | ||
|
||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import scala.concurrent.duration.DurationInt | ||
|
||
import org.bigbluebutton.SystemConfiguration | ||
import org.bigbluebutton.common2.bus.IncomingJsonMessageBus | ||
import org.bigbluebutton.common2.redis.{ RedisSubscriber, RedisSubscriberProvider } | ||
|
||
import akka.actor.ActorSystem | ||
import akka.actor.Props | ||
|
||
object AppsRedisSubscriberActor extends RedisSubscriber { | ||
|
||
val channels = Seq(toAkkaTranscodeRedisChannel) | ||
val patterns = Seq("bigbluebutton:to-bbb-transcode:*") | ||
|
||
def props(system: ActorSystem, jsonMsgBus: IncomingJsonMessageBus): Props = | ||
Props( | ||
classOf[AppsRedisSubscriberActor], | ||
system, jsonMsgBus, | ||
redisHost, redisPort, | ||
channels, patterns | ||
).withDispatcher("akka.redis-subscriber-worker-dispatcher") | ||
} | ||
|
||
class AppsRedisSubscriberActor( | ||
system: ActorSystem, | ||
msgBus: IncomingJsonMessageBus, redisHost: String, | ||
redisPort: Int, | ||
channels: Seq[String] = Nil, patterns: Seq[String] = Nil | ||
) | ||
extends RedisSubscriberProvider(system, "BbbTranscodeAkkaSub", channels, patterns, msgBus) with SystemConfiguration { | ||
|
||
var lastPongReceivedOn = 0L | ||
system.scheduler.schedule(10 seconds, 10 seconds)(checkPongMessage()) | ||
|
||
def checkPongMessage() { | ||
val now = System.currentTimeMillis() | ||
|
||
if (lastPongReceivedOn != 0 && (now - lastPongReceivedOn > 30000)) { | ||
log.error("BBB-Transcode pubsub error!"); | ||
} | ||
} | ||
|
||
addListener(toAkkaTranscodeJsonChannel) | ||
subscribe() | ||
} | ||
package org.bigbluebutton.endpoint.redis | ||
|
||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import scala.concurrent.duration.DurationInt | ||
import org.bigbluebutton.common2.redis.RedisConfig | ||
import org.bigbluebutton.common2.bus.IncomingJsonMessageBus | ||
import org.bigbluebutton.common2.redis.{ RedisSubscriber, RedisSubscriberProvider } | ||
|
||
import akka.actor.ActorSystem | ||
import akka.actor.Props | ||
|
||
object AppsRedisSubscriberActor { | ||
|
||
def props( | ||
system: ActorSystem, | ||
jsonMsgBus: IncomingJsonMessageBus, | ||
redisConfig: RedisConfig, | ||
channelsToSubscribe: Seq[String], | ||
patternsToSubscribe: Seq[String], | ||
forwardMsgToChannel: String | ||
): Props = | ||
Props( | ||
classOf[AppsRedisSubscriberActor], | ||
system, | ||
jsonMsgBus, | ||
redisConfig, | ||
channelsToSubscribe, | ||
patternsToSubscribe, | ||
forwardMsgToChannel | ||
).withDispatcher("akka.redis-subscriber-worker-dispatcher") | ||
} | ||
|
||
class AppsRedisSubscriberActor( | ||
system: ActorSystem, | ||
jsonMsgBus: IncomingJsonMessageBus, | ||
redisConfig: RedisConfig, | ||
channelsToSubscribe: Seq[String], | ||
patternsToSubscribe: Seq[String], | ||
forwardMsgToChannel: String | ||
) | ||
extends RedisSubscriberProvider( | ||
system, | ||
"BbbTranscodeAkkaSub", | ||
channelsToSubscribe, | ||
patternsToSubscribe, | ||
jsonMsgBus, | ||
redisConfig | ||
) { | ||
|
||
var lastPongReceivedOn = 0L | ||
system.scheduler.schedule(10 seconds, 10 seconds)(checkPongMessage()) | ||
|
||
def checkPongMessage() { | ||
val now = System.currentTimeMillis() | ||
|
||
if (lastPongReceivedOn != 0 && (now - lastPongReceivedOn > 30000)) { | ||
log.error("BBB-Transcode pubsub error!"); | ||
} | ||
} | ||
|
||
addListener(forwardMsgToChannel) | ||
subscribe() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters