Allow exposing graphdb and phpmyadmin via config
This commit is contained in:
parent
9f7ec20593
commit
a90c68bf5e
8 changed files with 139 additions and 14 deletions
|
|
@ -32,22 +32,14 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1-1">
|
||||
<h2 id="overview">Distillery Configuration</h2>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1-1">
|
||||
<pre>
|
||||
<code class="language-yaml">{{ .Config.MarshalSensitive }}</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1-1">
|
||||
<h2 id="overview">Distillery Passwords</h2>
|
||||
<h2 id="overview">Distillery Services</h2>
|
||||
<table class="pure-table pure-table-bordered padding">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service</th>
|
||||
<th>Interface</th>
|
||||
<th>Username</th>
|
||||
<th>Password</th>
|
||||
</tr>
|
||||
|
|
@ -57,6 +49,14 @@
|
|||
<td>
|
||||
SQL
|
||||
</td>
|
||||
<td>
|
||||
{{ $pma := .Config.HTTP.PhpMyAdminURL }}
|
||||
{{ if $pma }}
|
||||
<a href="{{ $pma }}" class="pure-button pure-button-small" target="_blank" rel="noopener noreferer">PHPMyAdmin</a>
|
||||
{{ else }}
|
||||
(accessible via SSH)
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
<code class="copy">{{ .Config.SQL.AdminUsername }}</code>
|
||||
</td>
|
||||
|
|
@ -68,6 +68,14 @@
|
|||
<td>
|
||||
Triplestore
|
||||
</td>
|
||||
<td>
|
||||
{{ $ts := .Config.HTTP.TSURL }}
|
||||
{{ if $ts }}
|
||||
<a href="{{ $ts }}" class="pure-button pure-button-small" target="_blank" rel="noopener noreferer">Workbench</a>
|
||||
{{ else }}
|
||||
(accessible via SSH)
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
<code class="copy">{{ .Config.TS.AdminUsername }}</code>
|
||||
</td>
|
||||
|
|
@ -77,4 +85,14 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1-1">
|
||||
<h2 id="overview">Distillery Configuration</h2>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1-1">
|
||||
<pre>
|
||||
<code class="language-yaml">{{ .Config.MarshalSensitive }}</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/config"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/tkw1536/pkglib/fsx/umaskfree"
|
||||
"github.com/tkw1536/pkglib/yamlx"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type SQL struct {
|
||||
|
|
@ -47,6 +50,23 @@ func (sql *SQL) Stack() component.StackWithResources {
|
|||
EnvContext: map[string]string{
|
||||
"DOCKER_NETWORK_NAME": sql.Config.Docker.Network(),
|
||||
"HTTPS_ENABLED": sql.Config.HTTP.HTTPSEnabledEnv(),
|
||||
"HOST_RULE": sql.Config.HTTP.HostRule(config.PHPMyAdminDomain.Domain()),
|
||||
},
|
||||
|
||||
ComposerYML: func(root *yaml.Node) (*yaml.Node, error) {
|
||||
// phpmyadmin is exposed => everything is fine
|
||||
if sql.Config.HTTP.PhpMyAdmin.Set && sql.Config.HTTP.PhpMyAdmin.Value {
|
||||
return root, nil
|
||||
}
|
||||
|
||||
// not exposed => remove the appropriate labels
|
||||
if err := yamlx.ReplaceWith(root, []string{
|
||||
"eu.wiss-ki.barrel.distillery=${DOCKER_NETWORK_NAME}",
|
||||
}, "services", "phpmyadmin", "labels"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return root, nil
|
||||
},
|
||||
|
||||
MakeDirsPerm: umaskfree.DefaultDirPerm,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,15 @@ services:
|
|||
- 127.0.0.1:8080:80
|
||||
labels:
|
||||
- "eu.wiss-ki.barrel.distillery=${DOCKER_NETWORK_NAME}"
|
||||
|
||||
# expose phpmyadmin (removed when disabled in global config)
|
||||
- "traefik.enable=True"
|
||||
|
||||
- "traefik.http.routers.core_phpmyadmin.rule=${HOST_RULE}"
|
||||
- "traefik.http.routers.core_phpmyadmin.tls=${HTTPS_ENABLED}"
|
||||
- "traefik.http.routers.core_phpmyadmin.tls.certresolver=distillery"
|
||||
|
||||
- "traefik.http.services.core_phpmyadmin.loadbalancer.server.port=80"
|
||||
depends_on:
|
||||
- sql
|
||||
restart: always
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/config"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/tkw1536/pkglib/yamlx"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type Triplestore struct {
|
||||
|
|
@ -43,6 +46,24 @@ func (ts *Triplestore) Stack() component.StackWithResources {
|
|||
|
||||
EnvContext: map[string]string{
|
||||
"DOCKER_NETWORK_NAME": ts.Config.Docker.Network(),
|
||||
"HOST_RULE": ts.Config.HTTP.HostRule(config.TriplestoreDomain.Domain()),
|
||||
"HTTPS_ENABLED": ts.Config.HTTP.HTTPSEnabledEnv(),
|
||||
},
|
||||
|
||||
ComposerYML: func(root *yaml.Node) (*yaml.Node, error) {
|
||||
// ts is exposed => everything is fine
|
||||
if ts.Config.HTTP.TS.Set && ts.Config.HTTP.TS.Value {
|
||||
return root, nil
|
||||
}
|
||||
|
||||
// not exposed => remove the appropriate labels
|
||||
if err := yamlx.ReplaceWith(root, []string{
|
||||
"eu.wiss-ki.barrel.distillery=${DOCKER_NETWORK_NAME}",
|
||||
}, "services", "triplestore", "labels"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return root, nil
|
||||
},
|
||||
|
||||
MakeDirs: []string{
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ EXPOSE 7200
|
|||
|
||||
# setup a healthcheck, that checks if the server is up.
|
||||
RUN apt-get update && apt-get install -y curl
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl --fail 127.0.0.1:7200/rest/repositories || exit 1
|
||||
# HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl --fail 127.0.0.1:7200/rest/repositories || exit 1
|
||||
|
||||
# Add volumes for data, work and logs as these might be accessible from the outside.
|
||||
# To add your own configuration, manually mount a config file into /opt/graphdb/work
|
||||
|
|
|
|||
|
|
@ -15,6 +15,19 @@ services:
|
|||
GDB_HEAP_SIZE: 16G
|
||||
labels:
|
||||
- "eu.wiss-ki.barrel.distillery=${DOCKER_NETWORK_NAME}"
|
||||
|
||||
# expose the triplestore (removed when disabled in global config)
|
||||
- "traefik.enable=True"
|
||||
|
||||
- "traefik.http.routers.core_ts.rule=${HOST_RULE}"
|
||||
- "traefik.http.routers.core_ts.tls=${HTTPS_ENABLED}"
|
||||
- "traefik.http.routers.core_ts.tls.certresolver=distillery"
|
||||
- "traefik.http.routers.core_ts.middlewares=core_ts@docker"
|
||||
|
||||
- "traefik.http.services.core_ts.loadbalancer.server.port=7200"
|
||||
- "traefik.http.services.core_ts.loadbalancer.passHostHeader=false"
|
||||
|
||||
- "traefik.http.middlewares.core_ts.headers.customRequestHeaders.host=localhost"
|
||||
|
||||
restart: always
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue