ubergeek77 / Lemmy-Easy-Deploy

Deploy Lemmy the easy way!
MIT License
133 stars 14 forks source link

Migration failure lemmy-ui #99

Closed BlueEther closed 2 months ago

BlueEther commented 2 months ago

lemmy ui was failing to start, with: `----> 'lemmy-ui' is still starting up. Log excerpt:

lemmy-ui-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { lemmy-ui-1 | [cause]: Error: connect EHOSTUNREACH 192.9.190.2:443 lemmy-ui-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16) { lemmy-ui-1 | errno: -113, lemmy-ui-1 | code: 'EHOSTUNREACH', lemmy-ui-1 | syscall: 'connect', lemmy-ui-1 | address: '192.9.190.2', lemmy-ui-1 | port: 443 lemmy-ui-1 | } lemmy-ui-1 | }`

I had to start Caddy manually

ubergeek77 commented 2 months ago

You said you had to start caddy manually, does that mean your instance is working now?

Also fyi, because you had to abort the deployment, your version string did not get written correctly, so Lemmy-Easy-Deploy will think you haven't updated yet.

BlueEther commented 2 months ago

After I started Caddy the easy-deploy script finished fine.

I wonder if it is a cloudflare issue, and start proxy before ui? I just reran the deploy and it completes fine with no update happening

# Define the list of services to expect, in deployment order
# This will be used to start each in order, and perform health checks
declare -a service_order=("postgres" "pictrs" "lemmy" "lemmy-ui" "proxy")`
==== Docker Information ====
Detected runtime: docker (Docker version 26.1.4, build 5650f9b)
Detected compose: docker compose (Docker Compose version v2.27.1)
   Runtime state: OK

==== System Information ====
      OS: Linux
  KERNEL: 5.15.0-1047-oracle (aarch64)
HOSTNAME: OK
   SHELL: bash
  MEMORY:
               total        used        free      shared  buff/cache   available
Mem:            11Gi       1.5Gi       502Mi       151Mi       9.7Gi       9.8Gi
Swap:             0B          0B          0B

DISTRO:
----------------------------
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
----------------------------

==== Lemmy-Easy-Deploy Information ====
Version: 1.4.1

IMAGE                                   CREATED        STATUS
lemmy-easy-deploy-proxy                 10 hours ago   Up 10 hours
ghcr.io/ubergeek77/lemmy-ui:0.19.5      10 hours ago   Up 10 hours (healthy)
ghcr.io/ubergeek77/lemmy:0.19.5         10 hours ago   Up 10 hours
pgautoupgrade/pgautoupgrade:16-alpine   10 hours ago   Up 10 hours
asonix/pictrs:0.5                       10 hours ago   Up 10 hours

Integrity:
    9e5be578245794e99d2b22e4dc89629a73a5d937e654c70456033efb5725565b  ./deploy.sh
    92c95dfc886792b8df2e9fffb540fc71a35c3bc6fd6c7662134da1545a79457a  ./templates/Caddy-Dockerfile.template
    c1202e70662dd2228da36a35a0f38ec8fc81bec8964d7315d02e8671a58dd7d7  ./templates/Caddyfile.template
    2537678c7971df36c1ed95f4228d3cfcb15bb4a28a60d939eaf8dd75b5d64a36  ./templates/cloudflare.snip
    c494a610bcb4cd1cfc0a4fe4fb0f6d437b2a84a0ad1625daee240e6dd6f1c910  ./templates/compose-email-volumes.snip
    c9cb4c5fee12930e17798a02ae1bd12e2dc69e149a394c24511bc9d4e6b776d4  ./templates/compose-email.snip
    0ec8ceb82e1f9f6517a229d964c4949c3e0501019ab94cc62e6f8c29c2e56203  ./templates/docker-compose.yml.template
    1c202b1b6e87c65b2fcda6035c9fe3f8631d76662907ffd38f24b14686e30647  ./templates/lemmy-email.snip
    1c202b1b6e87c65b2fcda6035c9fe3f8631d76662907ffd38f24b14686e30647  ./templates/lemmy-email.snip.bk
    2996e76b1fe84c8abd0d36352332781bec9608540372e70b39b0dab76b8150f7  ./templates/lemmy-email.snip.nologin
    6f937ab0cbe01b0cc6f9428b18dde987529e690d4ca24a22027c002617539fda  ./templates/lemmy.hjson.template

Custom Files: 
total 4.0K
-rw-rw-r-- 1 1001 1001 285 Jun 22 02:15 customPostfix.env

==== Settings ====
        CLOUDFLARE: Yes
 CADDY_DISABLE_TLS: false
   CADDY_HTTP_PORT: 80
  CADDY_HTTPS_PORT: 443
 LEMMY_TLS_ENABLED: true
      ENABLE_EMAIL: true
         SMTP_PORT: 587
    ENABLE_POSTFIX: false
POSTGRES_POOL_SIZE: 5
POSTGRES_SHM_SIZE: 64m

==== Generated Files ====
Deploy Version: 0.19.5;0.19.5

total 56K
-rw-r--r--  1 1001 1001    0 Jun 22 02:15 15_16_dump.sql
drwxr-xr-x  2 1001 1001 4.0K Jun 22 02:15 caddy
-rw-r--r--  1 1001 1001   84 Jun 22 10:08 caddy.env
-rw-r--r--  1 1001 1001  285 Jun 22 10:08 customPostfix.env
-rw-r--r--  1 1001 1001 1.8K Jun 22 10:08 docker-compose.yml
drwxr-xr-x 14 1001 1001 4.0K Jun 22 02:15 lemmy
drwxr-xr-x  7 1001 1001 4.0K Jun 22 02:15 lemmy-ui
drwxr-xr-x  2 1001 1001 4.0K Jun 22 02:15 lemmy-ui-themes
-rw-r--r--  1 1001 1001   50 Jun 22 02:15 lemmy.env
-rw-r--r--  1 1001 1001  860 Jun 22 10:08 lemmy.hjson
-rw-r--r--  1 1001 1001  106 Jun 22 02:17 pictrs.env
-rw-r--r--  1 1001 1001   34 Jun 22 10:08 postfix.env
-rw-r--r--  1 1001 1001   39 Jun 22 02:15 postgres.env
-rw-r--r--  1 1001 1001   51 Jun 22 02:15 postgres.env.bk
-rw-r--r--  1 1001 1001   14 Jun 22 10:08 version
ubergeek77 commented 2 months ago

To work around this issue, I have changed the service order to deploy caddy first. Hopefully this works better for you! Please let me know if it works.

BlueEther commented 2 months ago

Yep, that looks to have fixed it:

Lemmy-Easy-Deploy by ubergeek77 (v1.4.3)
========================================

Detected runtime: docker (Docker version 26.1.4, build 5650f9b)
Detected compose: docker compose (Docker Compose version v2.27.1)
   Runtime state: OK

 Current Backend Version: 0.19.3
  Latest Backend Version: 0.19.5

 Current Frontend Version: 0.19.3
  Latest Frontend Version: 0.19.5

A Backend update is available!
   BE: 0.19.3 --> 0.19.5

A Frontend update is available!
   FE: 0.19.3 --> 0.19.5

--------------------------------------------------------------------|
|  !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!  |
|                                                                   |
|    Updates to the Lemmy Backend perform a database migration!     |
|                                                                   |
|      This is generally safe, but Lemmy bugs may cause issues.     |
|                                                                   |
|   It is generally recommended to wait a day or two after a major  |
|    Lemmy update, to allow time for major bugs to be reported.     |
|                                                                   |
| If you update, and run into a new bug/issue in Lemmy, you will    |
| NOT be able to roll back, unless you restore a database backup!   |
|                                                                   |
|              LEMMY BACKEND UPDATES ARE ONE-WAY ONLY               |
|                                                                   |
| THIS IS YOUR ONLY OPPORTUNITY TO MAKE A BACKUP OF YOUR LEMMY DATA |
|                                                                   |
| Lemmy data is stored in Docker Volumes, **NOT** the ./live folder |
|                                                                   |
| Please consult the Docker docs for commands on making a backup:   |
|    https://docs.docker.com/storage/volumes/#back-up-a-volume      |
|                                                                   |
| The most important Volume to back up is named:                    |
|       lemmy-easy-deploy_postgres_data                             |
|                                                                   |
|  !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!  |
|-------------------------------------------------------------------|

Would you like to proceed with this deployment? [Y/n] y

Finding the best available Backend image, please wait...
--> Using Backend Image: ghcr.io/ubergeek77/lemmy:0.19.5

Finding the best available Frontend image, please wait...
--> Using Frontend Image: ghcr.io/ubergeek77/lemmy-ui:0.19.5

--> Found customPostfix.env; passing custom environment variables to 'postfix'
[+] Pulling 5/5
 ✔ proxy Skipped - No image to be pulled                                           0.0s 
 ✔ postgres Pulled                                                                 2.1s 
 ✔ lemmy Pulled                                                                    1.0s 
 ✔ lemmy-ui Pulled                                                                 1.0s 
 ✔ pictrs Pulled                                                                   2.0s 
[+] Building 1.8s (9/9) FINISHED                                         docker:default
 => [proxy internal] load build definition from Dockerfile                         0.0s
 => => transferring dockerfile: 201B                                               0.0s
 => [proxy internal] load metadata for docker.io/library/caddy:latest              1.6s
 => [proxy internal] load metadata for docker.io/library/caddy:builder             1.6s
 => [proxy internal] load .dockerignore                                            0.0s
 => => transferring context: 2B                                                    0.0s
 => [proxy builder 1/2] FROM docker.io/library/caddy:builder@sha256:0ad6668f14eb3  0.0s
 => => resolve docker.io/library/caddy:builder@sha256:0ad6668f14eb3b6e12f23228447  0.0s
 => [proxy stage-1 1/2] FROM docker.io/library/caddy:latest@sha256:2c7c4a3b9534b3  0.0s
 => => resolve docker.io/library/caddy:latest@sha256:2c7c4a3b9534b34d598a02e7d2be  0.0s
 => CACHED [proxy builder 2/2] RUN xcaddy build     --with github.com/caddy-dns/c  0.0s
 => CACHED [proxy stage-1 2/2] COPY --from=builder /usr/bin/caddy /usr/bin/caddy   0.0s
 => [proxy] exporting to image                                                     0.0s
 => => exporting layers                                                            0.0s
 => => writing image sha256:ddf273ee4fea92655f974ed7a4029f5a789c913958b8138e58bae  0.0s
 => => naming to docker.io/library/lemmy-easy-deploy-proxy                         0.0s
Warning: No resource found to remove for project "lemmy-easy-deploy".
[+] Creating 6/6
 ✔ Network lemmy-easy-deploy_default       Created                                 0.1s 
 ✔ Container lemmy-easy-deploy-pictrs-1    Created                                 0.1s 
 ✔ Container lemmy-easy-deploy-postgres-1  Created                                 0.1s 
 ✔ Container lemmy-easy-deploy-lemmy-1     Created                                 0.0s 
 ✔ Container lemmy-easy-deploy-lemmy-ui-1  Created                                 0.0s 
 ✔ Container lemmy-easy-deploy-proxy-1     Created                                 0.0s 

--> Starting proxy...
[+] Running 5/5
 ✔ Container lemmy-easy-deploy-postgres-1  Started                                 0.3s 
 ✔ Container lemmy-easy-deploy-pictrs-1    Started                                 0.3s 
 ✔ Container lemmy-easy-deploy-lemmy-1     Started                                 0.3s 
 ✔ Container lemmy-easy-deploy-lemmy-ui-1  Started                                 0.3s 
 ✔ Container lemmy-easy-deploy-proxy-1     Started                                 0.4s 
----> proxy is ready!

--> Starting postgres...
----> postgres is ready!

--> Starting pictrs...
----> pictrs is ready!

--> Starting lemmy...
----> lemmy is ready!

--> Starting lemmy-ui...
----> lemmy-ui is ready!
[+] Running 5/0
 ✔ Container lemmy-easy-deploy-postgres-1  Running                                 0.0s 
 ✔ Container lemmy-easy-deploy-pictrs-1    Running                                 0.0s 
 ✔ Container lemmy-easy-deploy-lemmy-1     Running                                 0.0s 
 ✔ Container lemmy-easy-deploy-lemmy-ui-1  Running                                 0.0s 
 ✔ Container lemmy-easy-deploy-proxy-1     Running                                 0.0s 

--> All services have been deployed successfully!

Deployment complete!
   BE: 0.19.5
   FE: 0.19.5

-------------------------------------------------------------------------------------------------
NOTE: Please do not run from the ./live folder directly, or you may cause volume name conflicts!

To shut down your deployment, run:
    ./deploy.sh --shutdown

To start your deployment back up, run
    ./deploy.sh

To re-deploy after making configuration changes, run
    ./deploy.sh -f

If you must manage your deployment manually, it is critical to supply the stack name:
    docker compose -p "lemmy-easy-deploy" [up/down/etc]

-------------------------------------------------------------------------------------------------