bundles/matrix-media-repo: download prebuilt executable instead of building ourselves

This commit is contained in:
Franzi 2022-04-03 08:04:16 +02:00
parent a5f76e98ec
commit 4ecf7ccb46
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 7 additions and 32 deletions

View file

@ -6,7 +6,7 @@ Requires=postgresql.service
[Service]
User=matrix-media-repo
Group=matrix-media-repo
ExecStart=/opt/matrix-media-repo/src/bin/media_repo -config /opt/matrix-media-repo/config.yaml
ExecStart=/opt/matrix-media-repo/media_repo -config /opt/matrix-media-repo/config.yaml
WorkingDirectory=/opt/matrix-media-repo/
Restart=always
RestartSec=2

View file

@ -3,10 +3,6 @@ directories = {
'owner': 'matrix-media-repo',
'group': 'matrix-media-repo',
},
'/opt/matrix-media-repo/src': {
'owner': 'matrix-media-repo',
'group': 'matrix-media-repo',
},
'/var/matrix/media': {
'owner': 'matrix-media-repo',
'group': 'matrix-media-repo',
@ -33,43 +29,23 @@ files = {
'svc_systemd:matrix-media-repo:restart',
},
},
}
git_deploy = {
'/opt/matrix-media-repo/src': {
'repo': 'https://github.com/turt2live/matrix-media-repo.git',
'rev': node.metadata['matrix-media-repo']['version'],
'/opt/matrix-media-repo/media_repo': {
'content_hash': node.metadata.get('matrix-media-repo/sha1', None),
'content_type': 'download',
'mode': '0755',
'source': 'https://github.com/turt2live/matrix-media-repo/releases/download/{}/media_repo-linux-x64'.format(node.metadata.get('matrix-media-repo/version')),
'triggers': {
'action:matrix-media-repo_build',
'svc_systemd:matrix-media-repo:restart',
},
},
}
actions = {
'matrix-media-repo_build': {
'command': \
'chown -R matrix-media-repo:matrix-media-repo /opt/matrix-media-repo/src && ' + \
'sudo -u matrix-media-repo bash -c "cd /opt/matrix-media-repo/src && ' + \
'GOBIN=/opt/matrix-media-repo/src/bin go install -v ./cmd/compile_assets && ' + \
'/opt/matrix-media-repo/src/bin/compile_assets && ' + \
'GOBIN=/opt/matrix-media-repo/src/bin go install -ldflags \\\"' + \
'-X github.com/turt2live/matrix-media-repo/common/version.GitCommit=$(cat /opt/matrix-media-repo/src/.bundlewrap_git_deploy) ' + \
'-X github.com/turt2live/matrix-media-repo/common/version.Version={}\\\" '.format(node.metadata['matrix-media-repo']['version']) + \
'-v ./cmd/..."',
'triggered': True,
'needs': {
'pkg_apt:',
},
},
}
svc_systemd = {
'matrix-media-repo': {
'needs': {
'action:matrix-media-repo_build',
'file:/etc/systemd/system/matrix-media-repo.service',
'file:/opt/matrix-media-repo/config.yaml',
'file:/opt/matrix-media-repo/media_repo',
'postgres_db:matrix-media-repo',
},
},

View file

@ -1,7 +1,6 @@
defaults = {
'apt': {
'packages': {
'golang-go': {},
'imagemagick': {},
'ffmpeg': {},
},