Synapse Dockerfile

This commit is contained in:
2022-02-24 22:59:13 +01:00
parent a9a854cba0
commit ead4876347
8 changed files with 70 additions and 34 deletions

3
.gitignore vendored
View File

@@ -9,6 +9,9 @@ build/
matrix.mv.db
matrix.trace.db
# Synapse data
docker/synapse/data
### STS ###
.apt_generated
.classpath

View File

@@ -1,27 +1,26 @@
server_name: "okupamicoche-synapse"
pid_file: /data/homeserver.pid
public_baseurl: http://okupamicoche-synapse:8008/
listeners:
- port: 8008
tls: false
type: http
x_forwarded: true
resources:
- names: [ client, federation ]
- names: [client, federation]
compress: false
database:
name: sqlite3
args:
database: /data/homeserver.db
enable_registration: true
log_config: "/data/okupamicoche-synapse.log.config"
log_config: "/config/localhost.log.config"
media_store_path: "/data/media_store"
registration_shared_secret: "Y_XNuno*Dh,T2IpHA;i,bWF^fg&x.*t=iEz*@:y5REBMhgCA63"
report_stats: false
signing_key_path: "/config/localhost.signing.key"
macaroon_secret_key: "6VvBQj_TedGcDDB_z,-qXV1W3:.CXrRG6AWF&4p:~iGNguy&_h"
form_secret: "FM,2TSq++sZ@Tl0atcQP"
signing_key_path: "/data/okupamicoche-synapse.signing.key"
trusted_key_servers:
- server_name: "matrix.org"
report_stats: false
suppress_key_server_warning: true
enable_registration: true
app_service_config_files:
- /okupamicoche-appservice.yaml
- /config/okupamicoche-appservice.yaml

View File

@@ -0,0 +1,33 @@
version: 1
formatters:
precise:
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
filters:
context:
(): synapse.util.logcontext.LoggingContextFilter
request: ""
handlers:
console:
class: logging.StreamHandler
formatter: precise
filters: [context]
loggers:
synapse:
level: WARNING
synapse.storage.SQL:
# beware: increasing this to DEBUG will make synapse log sensitive
# information such as access tokens.
level: WARNING
rest_auth_provider:
level: INFO
root:
level: WARNING
handlers: [console]

View File

@@ -0,0 +1 @@
ed25519 a_EgjW U0b5hmg9zXoLxAZFVDLTvtggKw+vkZQepCgjL8ZYRfI

View File

@@ -0,0 +1,19 @@
version: "3.3"
services:
synapse:
image: "matrixdotorg/synapse:latest"
container_name: "okupamicoche-synapse"
volumes:
- "./data:/data"
- "./config:/config"
environment:
VIRTUAL_HOST: "localhost"
VIRTUAL_PORT: 8008
SYNAPSE_SERVER_NAME: "okupamicoche-synapse"
SYNAPSE_REPORT_STATS: "no"
SYNAPSE_CONFIG_DIR: "/config"
GUI: 1000
UID: 1000
ports:
- "8008:8008"

View File

@@ -4,7 +4,6 @@ import io.ktor.http.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import net.folivo.trixnity.appservice.rest.DefaultAppserviceService
import net.folivo.trixnity.appservice.rest.MatrixAppserviceProperties
@@ -18,33 +17,25 @@ import net.folivo.trixnity.client.api.MatrixApiClient
import net.folivo.trixnity.core.model.RoomAliasId
import net.folivo.trixnity.core.model.RoomId
import net.folivo.trixnity.core.model.UserId
import net.folivo.trixnity.core.model.events.m.room.RoomMessageEventContent
val matrixClient = MatrixApiClient(
baseUrl = Url("http://okupamicoche-synapse:8008/"),
).apply { accessToken.value = "syt_dGVzdDM_OIheLExYmDBsfAeENWfF_3BwxFM" }
//).apply { accessToken.value = "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" } // TODO Error 500
).apply { accessToken.value = "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" }
suspend fun main() {
coroutineScope {
matrixClient.sync.subscribe<RoomMessageEventContent.TextMessageEventContent> { println(it.content.body) }
matrixClient.sync.subscribeAllEvents { // this is a shortcut for .subscribe<EventContent> { }
// println(it)
}
launch {
matrixClient.sync.start(wait = true, scope = this) // you need to start the sync to receive messages
}
val appserviceService = DefaultAppserviceService(
EventTnxService(),
UserService(),
RoomService()
)
println(3)
appserviceService.subscribeAllEvents {
event -> println(event)
}
launch {
embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
matrixAppserviceModule(
@@ -53,7 +44,6 @@ suspend fun main() {
)
}.start(wait = true)
}
println(4)
}

View File

@@ -1,13 +1,4 @@
package eu.fosil
import io.ktor.server.routing.*
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.request.*
import kotlin.test.*
import io.ktor.server.testing.*
import eu.fosil.plugins.*
class ApplicationTest {
}