浏览代码

Upgraded Snap Candidate to have base core24, MongoDB 7 and Caddy 2.

Thanks to xet7 !
Lauri Ojansivu 2 天之前
父节点
当前提交
6526d99123
共有 4 个文件被更改,包括 107 次插入79 次删除
  1. 23 12
      snap-src/Caddyfile
  2. 5 2
      snap-src/bin/caddy-control
  3. 6 6
      snap-src/bin/mongodb-control
  4. 73 59
      snapcraft.yaml

+ 23 - 12
snap-src/Caddyfile

@@ -1,18 +1,29 @@
-http://:8080
-proxy / localhost:3001 {
-  websocket
-  transparent
+# Caddy 2 configuration for Wekan
+
+:8080 {
+  # Reverse proxy to Wekan
+  reverse_proxy localhost:3001 {
+    # Enable WebSocket support
+    header_up Connection {>Connection}
+    header_up Upgrade {>Upgrade}
+  }
 }
 }
 
 
-## SSL/TLS example. Firefox Inspect Console does not support http/2, so turning it off
-## so that Firefox would not show wss websocket errors. Chrome console supports http/2.
-#
-#wekan.example.com {
+# SSL/TLS example with HTTP/2 disabled for Firefox WebSocket compatibility
+# Uncomment and customize for your domain
+#{$DOMAIN:wekan.example.com} {
+#  # Enable TLS but use HTTP/1.1 protocol
 #  tls {
 #  tls {
-#    alpn http/1.1
+#    protocols tls1.2 tls1.3
 #  }
 #  }
-#   proxy / localhost:3001 {
-#     websocket
-#     transparent
+#  # Force HTTP/1.1
+#  protocols h1
+#
+#  # Reverse proxy to Wekan
+#  reverse_proxy localhost:3001 {
+#    # Enable WebSocket support
+#    header_up Connection {>Connection}
+#    header_up Upgrade {>Upgrade}
 #  }
 #  }
 #}
 #}
+#}

+ 5 - 2
snap-src/bin/caddy-control

@@ -1,10 +1,13 @@
 #!/bin/bash
 #!/bin/bash
 
 
-# get wekan/mongo settings
+# Get wekan/mongo settings
 source $SNAP/bin/wekan-read-settings
 source $SNAP/bin/wekan-read-settings
 
 
 if [ "$CADDY_ENABLED" = "true" ]; then
 if [ "$CADDY_ENABLED" = "true" ]; then
-    env LC_ALL=C caddy -conf=$SNAP_COMMON/Caddyfile -host=localhost:${CADDY_PORT} -agree
+    # Use Caddy 2 command format
+    # The 'host' option is no longer needed in Caddy 2
+    # The 'agree' option is no longer needed as Caddy 2 doesn't prompt for EULA
+    env LC_ALL=C caddy run --config $SNAP_COMMON/Caddyfile
 else
 else
     echo "caddy is disabled. Stop service"
     echo "caddy is disabled. Stop service"
     snapctl stop --disable ${SNAP_NAME}.caddy
     snapctl stop --disable ${SNAP_NAME}.caddy

+ 6 - 6
snap-src/bin/mongodb-control

@@ -102,18 +102,18 @@ if [ -z "${MONGO_URL}" ]; then
 
 
     if [ "syslog" == "${MONGO_LOG_DESTINATION}" ]; then
     if [ "syslog" == "${MONGO_LOG_DESTINATION}" ]; then
         echo "Sending mongodb logs to syslog"
         echo "Sending mongodb logs to syslog"
-        mongod --dbpath ${SNAP_COMMON} --syslog --journal ${BIND_OPTIONS} --quiet
+        mongod --dbpath ${SNAP_COMMON} --syslog ${BIND_OPTIONS} --quiet
         exit 0
         exit 0
     fi
     fi
 
 
     if [ "snapcommon" == "${MONGO_LOG_DESTINATION}" ]; then
     if [ "snapcommon" == "${MONGO_LOG_DESTINATION}" ]; then
         echo "Sending mongodb logs to $SNAP_COMMON"
         echo "Sending mongodb logs to $SNAP_COMMON"
-        mongod --dbpath ${SNAP_COMMON} --logpath ${SNAP_COMMON}/mongodb.log --logappend --journal ${BIND_OPTIONS} --quiet
+        mongod --dbpath ${SNAP_COMMON} --logpath ${SNAP_COMMON}/mongodb.log --logappend ${BIND_OPTIONS} --quiet
     fi
     fi
 
 
     if [ "devnull" == "${MONGO_LOG_DESTINATION}" ]; then
     if [ "devnull" == "${MONGO_LOG_DESTINATION}" ]; then
         echo "Sending mongodb logs to /dev/null"
         echo "Sending mongodb logs to /dev/null"
-        mongod --dbpath ${SNAP_COMMON} --logpath /dev/null --journal ${BIND_OPTIONS} --quiet
+        mongod --dbpath ${SNAP_COMMON} --logpath /dev/null ${BIND_OPTIONS} --quiet
     fi
     fi
     #echo "mongodb log destination: ${MONGO_LOG_DESTINATION}" >> "${SNAP_COMMON}/settings.log"
     #echo "mongodb log destination: ${MONGO_LOG_DESTINATION}" >> "${SNAP_COMMON}/settings.log"
 
 
@@ -138,17 +138,17 @@ else
 
 
     if [ "syslog" == "${MONGO_LOG_DESTINATION}" ]; then
     if [ "syslog" == "${MONGO_LOG_DESTINATION}" ]; then
         echo "Sending mongodb logs to syslog"
         echo "Sending mongodb logs to syslog"
-        mongod --dbpath ${SNAP_COMMON} --syslog --journal ${MONGO_URL} --quiet
+        mongod --dbpath ${SNAP_COMMON} --syslog ${MONGO_URL} --quiet
     fi
     fi
 
 
     if [ "snapcommon" == "${MONGO_LOG_DESTINATION}" ]; then
     if [ "snapcommon" == "${MONGO_LOG_DESTINATION}" ]; then
         echo "Sending mongodb logs to ${SNAP_COMMON}"
         echo "Sending mongodb logs to ${SNAP_COMMON}"
-        mongod --dbpath ${SNAP_COMMON} --logpath ${SNAP_COMMON}/mongodb.log --logappend --journal ${MONGO_URL} --quiet
+        mongod --dbpath ${SNAP_COMMON} --logpath ${SNAP_COMMON}/mongodb.log --logappend ${MONGO_URL} --quiet
     fi
     fi
 
 
     if [ "devnull" == "${MONGO_LOG_DESTINATION}" ]; then
     if [ "devnull" == "${MONGO_LOG_DESTINATION}" ]; then
         echo "Sending mongodb logs to /dev/null"
         echo "Sending mongodb logs to /dev/null"
-        mongod --dbpath ${SNAP_COMMON} --logpath /dev/null --journal ${MONGO_URL} --quiet
+        mongod --dbpath ${SNAP_COMMON} --logpath /dev/null ${MONGO_URL} --quiet
     fi
     fi
 
 
     # Disable MongoDB telemetry and free monitoring
     # Disable MongoDB telemetry and free monitoring

+ 73 - 59
snapcraft.yaml

@@ -1,11 +1,11 @@
 name: wekan
 name: wekan
 version: '7.92'
 version: '7.92'
-base: core20
+base: core24
 summary: Open Source kanban
 summary: Open Source kanban
 description: |
 description: |
    WeKan ® is an Open Source and collaborative kanban board application.
    WeKan ® is an Open Source and collaborative kanban board application.
 
 
-   Whether youre maintaining a personal todo list, planning your holidays with some friends, or working in a team on your next revolutionary idea, Kanban boards are an unbeatable tool to keep your things organized. They give you a visual overview of the current state of your project, and make you productive by allowing you to focus on the few items that matter the most.
+   Whether you're maintaining a personal todo list, planning your holidays with some friends, or working in a team on your next revolutionary idea, Kanban boards are an unbeatable tool to keep your things organized. They give you a visual overview of the current state of your project, and make you productive by allowing you to focus on the few items that matter the most.
    Depending on target environment, some configuration settings might need to be adjusted.
    Depending on target environment, some configuration settings might need to be adjusted.
    For full list of configuration options call:
    For full list of configuration options call:
    $ wekan.help
    $ wekan.help
@@ -13,8 +13,11 @@ description: |
 confinement: strict
 confinement: strict
 grade: stable
 grade: stable
 
 
-architectures:
-  - amd64
+# Update platforms format to correct syntax for core24
+platforms:
+  amd64:
+    build-on: amd64
+    build-for: amd64
 
 
 plugs:
 plugs:
   mongodb-plug:
   mongodb-plug:
@@ -65,63 +68,46 @@ apps:
 
 
 parts:
 parts:
     mongodb:
     mongodb:
-        source: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.24.tgz
+        source: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.21.tgz
         plugin: dump
         plugin: dump
         stage-packages:
         stage-packages:
-            - libssl1.1
+            - libssl3
             - libcurl4
             - libcurl4
             - libstemmer0d
             - libstemmer0d
             - zlib1g
             - zlib1g
             - libsnappy1v5
             - libsnappy1v5
-            - libyaml-cpp0.6
+            - libyaml-cpp0.8
             - libpcre3
             - libpcre3
             - libpcrecpp0v5
             - libpcrecpp0v5
-            - libboost-system1.71.0
-            - libboost-iostreams1.71.0
-            - libboost-filesystem1.71.0
-            - libboost-program-options1.71.0
+            - libboost-system1.74.0
+            - libboost-iostreams1.74.0
+            - libboost-filesystem1.74.0
+            - libboost-program-options1.74.0
             - libgoogle-perftools4
             - libgoogle-perftools4
-        filesets:
-            mongo:
-                - bin
-                - usr
         stage:
         stage:
-            - $mongo
+            - bin
+            - usr
         prime:
         prime:
-            - $mongo
+            - bin
+            - usr
 
 
     mongosh:
     mongosh:
-        source: https://downloads.mongodb.com/compass/mongodb-mongosh_2.1.1_amd64.deb
+        source: https://downloads.mongodb.com/compass/mongosh-2.5.3-linux-x64.tgz
         plugin: dump
         plugin: dump
 
 
     mongotools:
     mongotools:
-        source: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.9.4.tgz
+        source: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2404-x86_64-100.12.2.tgz
         plugin: dump
         plugin: dump
 
 
-#    mongodb44:
-#        source: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.18.tgz
-#        plugin: dump
-#        organize:
-#          bin: mongo44bin
-#          usr: mongo44usr
-#        stage:
-#          - -init
-
     wekan:
     wekan:
         source: .
         source: .
         plugin: npm
         plugin: npm
         npm-node-version: 14.21.3
         npm-node-version: 14.21.3
-        ## Node.js 14.21.4 from Meteor only exists URL below where it's downloaded and installed.
-        ## It does not exists in that npm-node-version above.
-        #npm-packages:
-        #    - node-gyp
-        #    - node-pre-gyp
-        #    - fibers
+        npm-include-node: true
         build-packages:
         build-packages:
             - build-essential
             - build-essential
             - ca-certificates
             - ca-certificates
             - apt-utils
             - apt-utils
-#            - python2
             - python3
             - python3
             - g++
             - g++
             - capnproto
             - capnproto
@@ -131,7 +117,7 @@ parts:
             - execstack
             - execstack
             - nodejs
             - nodejs
             - npm
             - npm
-#            - p7zip-full
+            - git  # Add git for cloning migratemongo
         stage-packages:
         stage-packages:
             - libfontconfig1
             - libfontconfig1
         override-build: |
         override-build: |
@@ -196,14 +182,14 @@ parts:
             cp -r .build/bundle/* $SNAPCRAFT_PART_INSTALL/
             cp -r .build/bundle/* $SNAPCRAFT_PART_INSTALL/
             cp .build/bundle/.node_version.txt $SNAPCRAFT_PART_INSTALL/
             cp .build/bundle/.node_version.txt $SNAPCRAFT_PART_INSTALL/
             rm -f $SNAPCRAFT_PART_INSTALL/lib/node_modules/wekan
             rm -f $SNAPCRAFT_PART_INSTALL/lib/node_modules/wekan
-            # Migrate MongoDB 3 to 6
-            wget https://github.com/wekan/migratemongo/archive/refs/heads/main.zip
-            unzip main.zip
-            mv migratemongo-main migratemongo
+
+            # Migrate MongoDB 3 to 6 - clone directly from git instead of downloading zip
+            echo "Cloning migratemongo repository..."
+            git clone https://github.com/wekan/migratemongo.git
+            echo "Copy migratemongo files to install directory..."
             cp -pR migratemongo $SNAPCRAFT_PART_INSTALL/
             cp -pR migratemongo $SNAPCRAFT_PART_INSTALL/
             rm -rf migratemongo
             rm -rf migratemongo
-            rm main.zip
-            #rm -f $SNAPCRAFT_PART_INSTALL/programs/server/npm/node_modules/meteor/rajit_bootstrap3-datepicker/lib/bootstrap-datepicker/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
+
             # Delete phantomjs that is in accounts-lockout
             # Delete phantomjs that is in accounts-lockout
             #rm -rf $SNAPCRAFT_PART_INSTALL/programs/server/npm/node_modules/meteor/lucasantoniassi_accounts-lockout/node_modules/phantomjs-prebuilt
             #rm -rf $SNAPCRAFT_PART_INSTALL/programs/server/npm/node_modules/meteor/lucasantoniassi_accounts-lockout/node_modules/phantomjs-prebuilt
             # Delete temporary files
             # Delete temporary files
@@ -228,21 +214,49 @@ parts:
         plugin: dump
         plugin: dump
 
 
     caddy:
     caddy:
-        plugin: dump
-        ## Caddy v1 is not developed anymore. TODO: Sometime migrate to Caddy v2.
-        ## https://caddy.community/t/caddyfile-v1-adapter/9129
-        ## https://github.com/caddyserver/caddy/tree/v1
-        #source: https://caddyserver.com/download/linux/amd64?license=personal&telemetry=off
-        #source-type: tar
-        # Using last working binary that was downloaded from above URL to Wekan Snap,
-        # and .txt files from https://github.com/caddyserver/caddy/tree/v1/dist
-        source: https://wekan.github.io/caddy-v1-linux-amd64.7z
-        source-type: 7z
-        organize:
-          caddy: bin/caddy
-          CHANGES.txt: license/CADDY_CHANGES.txt
-          EULA.txt: license/CADDY_EULA.txt
-          LICENSES.txt: license/CADDY_LICENSES.txt
-          README.txt: license/CADDY_README.txt
+        plugin: nil
+        build-packages:
+            - debian-keyring
+            - debian-archive-keyring
+            - apt-transport-https
+            - gnupg
+            - curl
+        override-build: |
+            # Add Caddy repository
+            echo "Installing Caddy 2 from the official repository..."
+            curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /tmp/caddy-stable-archive-keyring.gpg
+            mkdir -p /etc/apt/keyrings
+            cp /tmp/caddy-stable-archive-keyring.gpg /etc/apt/keyrings/
+            echo "deb [signed-by=/etc/apt/keyrings/caddy-stable-archive-keyring.gpg] https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main" > /etc/apt/sources.list.d/caddy-stable.list
+            apt update
+            apt -y install caddy
+
+            # Display installed Caddy version for confirmation
+            echo "Installed Caddy version:"
+            /usr/bin/caddy version
+
+            # Create directory structure in the snap
+            mkdir -p $SNAPCRAFT_PART_INSTALL/bin
+
+            # Copy Caddy binary
+            cp /usr/bin/caddy $SNAPCRAFT_PART_INSTALL/bin/
+            chmod +x $SNAPCRAFT_PART_INSTALL/bin/caddy
+
+            # Create license files manually since they don't exist in the package
+            mkdir -p $SNAPCRAFT_PART_INSTALL/license
+            echo "Caddy is licensed under the Apache License 2.0. See https://github.com/caddyserver/caddy/blob/master/LICENSE" > $SNAPCRAFT_PART_INSTALL/license/CADDY_LICENSE
+
+            # Create a basic default Caddyfile for the snap
+            mkdir -p $SNAPCRAFT_PART_INSTALL/etc
+            cat > $SNAPCRAFT_PART_INSTALL/etc/Caddyfile << 'EOF'
+            # Default Caddyfile for Wekan
+            # This is loaded by caddy-control script if no other config is provided
+
+            :8080 {
+                reverse_proxy localhost:3000
+            }
+            EOF
         stage:
         stage:
-          - -init
+            - bin/caddy
+            - license/CADDY_LICENSE
+            - etc/Caddyfile