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 DATABASE_PATH=/data/zdravko.db
ENV TEMPORAL_DATABASE_PATH=/data/temporal.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. # See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'zdravko' app = 'zdravko'
primary_region = 'waw' primary_region = 'waw'
[build] [build]
dockerfile = "Dockerfile" image = 'ghcr.io/mentos1386/zdravko:main'
context = "deploy"
[env] [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_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' OAUTH2_ENDPOINT_USER_INFO_URL = 'https://api.github.com/user'
ROOT_URL = 'https://zdravko.mnts.dev'
TEMPORAL_UI_HOST = 'server.process.zdravko.internal:8223'
TEMPORAL_SERVER_HOST = 'server.process.zdravko.internal:7233' TEMPORAL_SERVER_HOST = 'server.process.zdravko.internal:7233'
[processes] [processes]
server = "/zdravko --temporal=true --server=true --worker=false" server = '--temporal=true --server=true --worker=false'
worker = "/zdravko --temporal=false --server=false --worker=true" worker = '--temporal=false --server=false --worker=true'
[[mounts]] [[mounts]]
source = "zdravko_data" source = 'data'
destination = "/var/lib/litefs" destination = '/data'
processes = ["server"] processes = ['server']
[http_service] [http_service]
processes = ["server"]
internal_port = 8080 internal_port = 8080
force_https = true force_https = true
auto_stop_machines = true auto_stop_machines = true
auto_start_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]] [[vm]]
cpu_kind = 'shared' cpu_kind = 'shared'
cpus = 1 cpus = 1
memory_mb = 256 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 { type HealthcheckHttpAddToHistoryResult struct {
} }
func HealthcheckHttpWriteResult(ctx context.Context, param HealtcheckHttpParam) (*HealthcheckHttpResult, error) { func HealthcheckHttpAddToHistory(ctx context.Context, param HealtcheckHttpAddToHistoryParam) (*HealthcheckHttpAddToHistoryResult, error) {
if param.Method == "" {
param.Method = "GET" return &HealthcheckHttpAddToHistoryResult{}, nil
}
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
} }

View file

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