ci(deploy): trying to fix deploy

This commit is contained in:
Tine 2024-02-17 21:31:09 +01:00
parent b1a766f9b6
commit 99ec1a5fb0
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
7 changed files with 30 additions and 98 deletions

View file

@ -35,4 +35,4 @@ VOLUME /data
ENV DATABASE_PATH=/data/zdravko.db
ENV TEMPORAL_DATABASE_PATH=/data/temporal.db
ENTRYPOINT ["/zdravko"]
ENTRYPOINT ["/bin/zdravko"]

View file

@ -1,14 +0,0 @@
# syntax=docker/dockerfile:1
ARG ZDRAVKO_VERSION=main
FROM ghcr.io/mentos1386/zdravko:${ZDRAVKO_VERSION}
RUN apt-get update -y \
&& apt-get install -y ca-certificates fuse3 sqlite3
COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs
COPY deploy/litefs.yaml /etc/litefs.yml
COPY deploy/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -1,14 +0,0 @@
#!/bin/sh
PROCESS=${FLY_PROCESS_GROUP}
if [ "$PROCESS" = "server" ]; then
echo "Starting server process"
exec litefs mount -- $@
elif [ "$PROCESS" = "worker" ]; then
echo "Starting worker process"
exec $@
else
echo "Unknown process"
exit 1
fi

View file

@ -1,39 +1,52 @@
# fly.toml app configuration file generated for zdravko on 2024-02-17T21:20:17+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'zdravko'
primary_region = 'waw'
[build]
dockerfile = "Dockerfile"
context = "deploy"
image = 'ghcr.io/mentos1386/zdravko:main'
[env]
ROOT_URL = 'https://zdravko.mnts.dev'
OAUTH2_ENDPOINT_TOKEN_URL = 'https://github.com/login/oauth/access_token'
OAUTH2_ENDPOINT_AUTH_URL = 'https://github.com/login/oauth/authorize'
OAUTH2_ENDPOINT_TOKEN_URL = 'https://github.com/login/oauth/access_token'
OAUTH2_ENDPOINT_USER_INFO_URL = 'https://api.github.com/user'
TEMPORAL_UI_HOST = 'server.process.zdravko.internal:8223'
ROOT_URL = 'https://zdravko.mnts.dev'
TEMPORAL_SERVER_HOST = 'server.process.zdravko.internal:7233'
[processes]
server = "/zdravko --temporal=true --server=true --worker=false"
worker = "/zdravko --temporal=false --server=false --worker=true"
server = '--temporal=true --server=true --worker=false'
worker = '--temporal=false --server=false --worker=true'
[[mounts]]
source = "zdravko_data"
destination = "/var/lib/litefs"
processes = ["server"]
source = 'data'
destination = '/data'
processes = ['server']
[http_service]
processes = ["server"]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['server']
[[services]]
protocol = 'tcp'
internal_port = 7233
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['server']
[[services.ports]]
port = 7233
handlers = ['tls']
[[vm]]
cpu_kind = 'shared'
cpus = 1
memory_mb = 256
processes = ['server', 'worker']

View file

@ -1,32 +0,0 @@
# This directory is where your application will access the database.
fuse:
dir: "/data"
# This directory is where LiteFS will store internal data.
# You must place this directory on a persistent volume.
data:
dir: "/var/lib/litefs"
lease:
type: "consul"
# Specifies if this node can become primary. The expression below evaluates
# to true on nodes that are run in the primary region. Nodes in other regions
# act as non-candidate, read-only replicas.
candidate: ${FLY_REGION == PRIMARY_REGION}
# If true, then the node will automatically become primary after it has
# connected with the cluster and sync'd up. This makes it easier to run
# migrations on start up.
promote: true
# The API URL that other nodes will use to connect to this node.
advertise-url: "http://${FLY_ALLOC_ID}.vm.${FLY_APP_NAME}.internal:20202"
consul:
# The URL of the Consul cluster.
url: "${FLY_CONSUL_URL}"
# A unique key shared by all nodes in the LiteFS cluster.
# Change this if you are running multiple clusters in a single app!
key: "${FLY_APP_NAME}/primary"

View file

@ -50,28 +50,7 @@ type HealtcheckHttpAddToHistoryParam struct {
type HealthcheckHttpAddToHistoryResult struct {
}
func HealthcheckHttpWriteResult(ctx context.Context, param HealtcheckHttpParam) (*HealthcheckHttpResult, error) {
if param.Method == "" {
param.Method = "GET"
}
func HealthcheckHttpAddToHistory(ctx context.Context, param HealtcheckHttpAddToHistoryParam) (*HealthcheckHttpAddToHistoryResult, error) {
var (
response *http.Response
err error
)
switch param.Method {
case "GET":
response, err = http.Get(param.Url)
case "POST":
response, err = http.Post(param.Url, "application/json", nil)
}
if err != nil {
return nil, err
}
log.Printf("HealthcheckHttpActivityDefinition produced statuscode %d for url %s", response.StatusCode, param.Url)
return &HealthcheckHttpResult{StatusCode: response.StatusCode}, nil
return &HealthcheckHttpAddToHistoryResult{}, nil
}

View file

@ -20,7 +20,7 @@ run-zdravko:
# Deploy the application to fly.io
deploy:
fly deploy -c deploy/fly.toml
fly deploy --ha=false -c deploy/fly.toml
# Start devbox shell
shell: