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] [Service]
User=matrix-media-repo User=matrix-media-repo
Group=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/ WorkingDirectory=/opt/matrix-media-repo/
Restart=always Restart=always
RestartSec=2 RestartSec=2

View file

@ -3,10 +3,6 @@ directories = {
'owner': 'matrix-media-repo', 'owner': 'matrix-media-repo',
'group': 'matrix-media-repo', 'group': 'matrix-media-repo',
}, },
'/opt/matrix-media-repo/src': {
'owner': 'matrix-media-repo',
'group': 'matrix-media-repo',
},
'/var/matrix/media': { '/var/matrix/media': {
'owner': 'matrix-media-repo', 'owner': 'matrix-media-repo',
'group': 'matrix-media-repo', 'group': 'matrix-media-repo',
@ -33,43 +29,23 @@ files = {
'svc_systemd:matrix-media-repo:restart', 'svc_systemd:matrix-media-repo:restart',
}, },
}, },
} '/opt/matrix-media-repo/media_repo': {
'content_hash': node.metadata.get('matrix-media-repo/sha1', None),
git_deploy = { 'content_type': 'download',
'/opt/matrix-media-repo/src': { 'mode': '0755',
'repo': 'https://github.com/turt2live/matrix-media-repo.git', 'source': 'https://github.com/turt2live/matrix-media-repo/releases/download/{}/media_repo-linux-x64'.format(node.metadata.get('matrix-media-repo/version')),
'rev': node.metadata['matrix-media-repo']['version'],
'triggers': { 'triggers': {
'action:matrix-media-repo_build',
'svc_systemd:matrix-media-repo:restart', '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 = { svc_systemd = {
'matrix-media-repo': { 'matrix-media-repo': {
'needs': { 'needs': {
'action:matrix-media-repo_build',
'file:/etc/systemd/system/matrix-media-repo.service', 'file:/etc/systemd/system/matrix-media-repo.service',
'file:/opt/matrix-media-repo/config.yaml', 'file:/opt/matrix-media-repo/config.yaml',
'file:/opt/matrix-media-repo/media_repo',
'postgres_db:matrix-media-repo', 'postgres_db:matrix-media-repo',
}, },
}, },

View file

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