← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ines-almeida/launchpad-mojo-specs/+git/private:lp-fetch-service into ~launchpad/launchpad-mojo-specs/+git/private:master

 

Ines Almeida has proposed merging ~ines-almeida/launchpad-mojo-specs/+git/private:lp-fetch-service into ~launchpad/launchpad-mojo-specs/+git/private:master.

Commit message:
Add barebones of lp-fetch-service mojo spec
    
While the charm and snap are not public, they require manually building, and deploying from the local charm


Requested reviews:
  Jürgen Gmach (jugmac00)

For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad-mojo-specs/+git/private/+merge/461232

Resubmitting this MP to update the target branch.


This was tested deploying locally. Will try deploying in staging once this MP is reviewed and approved.

The general structure was based on similar lp specs.


-- 
Your team Launchpad code reviewers is subscribed to branch ~launchpad/launchpad-mojo-specs/+git/private:master.
diff --git a/lp-fetch-service/README.md b/lp-fetch-service/README.md
new file mode 100644
index 0000000..65e09cb
--- /dev/null
+++ b/lp-fetch-service/README.md
@@ -0,0 +1,21 @@
+# Launchpad fetch service
+
+This spec deploys Launchpad's fetch service.
+
+You can run it locally using Juju's LXD support and Mojo. First, configure
+your environment:
+
+    export MOJO_ROOT="$HOME/.local/share/mojo"
+    export MOJO_PROJECT=mojo-lp-fetch-service
+    export MOJO_WORKSPACE=devel
+    export MOJO_SERIES=jammy
+    export MOJO_SPEC=git+https://git.launchpad.net/~launchpad/launchpad-mojo-specs/+git/private
+    export MOJO_STAGE=lp-fetch-service/devel
+
+Then run the spec using Mojo:
+
+    mojo project-new -c containerless
+    mojo workspace-new
+    mojo run
+
+You must have python3-yaml installed.
diff --git a/lp-fetch-service/bundle.yaml b/lp-fetch-service/bundle.yaml
new file mode 100644
index 0000000..2811116
--- /dev/null
+++ b/lp-fetch-service/bundle.yaml
@@ -0,0 +1,22 @@
+{%- if stage_name == "production" %}
+{%-   set devel = False %}
+{%- elif stage_name == "staging" %}
+{%-   set devel = False %}
+{%- else %}
+{%-   set devel = True %}
+{%- endif -%}
+
+series: jammy
+applications:
+{%- if devel or stage_name == "staging" %}
+  fetch-service:
+    {#- While the fetch-service charm and snap are not public, we are deploying
+        a locally built charm. The lines below should be replaced with the path
+        to charmhub, channel and revision number once the charm and snap are
+        public. Currently, this expects the charm and snap to be copied to the
+        path where the bundle.yaml is rendered, in the mojo project folder (eg.
+        .../mojo/lp-fetch-service/jammy/devel/charms/lp-fetch-service/). #}
+    charm: "./fetch-service_ubuntu-22.04-amd64.charm"
+    resources:
+      snap: "./fetch-service.snap"
+{%- endif %}
diff --git a/lp-fetch-service/configs/custom-secgroups-staging.yaml b/lp-fetch-service/configs/custom-secgroups-staging.yaml
new file mode 100644
index 0000000..78f1546
--- /dev/null
+++ b/lp-fetch-service/configs/custom-secgroups-staging.yaml
@@ -0,0 +1,9 @@
+applications:
+    fetch-service:
+        type: neutron
+        rules:
+            - rsync-logs
+rules:
+    rsync-logs:
+        # Allow launchpad-bastion-ps5 to fetch logs.
+        - {"protocol": "tcp", "family": "IPv4", "port": 873, "cidr": "10.131.10.100/32"}
diff --git a/lp-fetch-service/manifest b/lp-fetch-service/manifest
new file mode 120000
index 0000000..e1c38b1
--- /dev/null
+++ b/lp-fetch-service/manifest
@@ -0,0 +1 @@
+manifests/deploy
\ No newline at end of file
diff --git a/lp-fetch-service/manifest-perform-autodeploy b/lp-fetch-service/manifest-perform-autodeploy
new file mode 120000
index 0000000..e1c38b1
--- /dev/null
+++ b/lp-fetch-service/manifest-perform-autodeploy
@@ -0,0 +1 @@
+manifests/deploy
\ No newline at end of file
diff --git a/lp-fetch-service/manifest-verify b/lp-fetch-service/manifest-verify
new file mode 120000
index 0000000..6e02de4
--- /dev/null
+++ b/lp-fetch-service/manifest-verify
@@ -0,0 +1 @@
+manifests/verify
\ No newline at end of file
diff --git a/lp-fetch-service/manifests/deploy b/lp-fetch-service/manifests/deploy
new file mode 100644
index 0000000..2d52196
--- /dev/null
+++ b/lp-fetch-service/manifests/deploy
@@ -0,0 +1,5 @@
+script config=predeploy
+bundle config=bundle.yaml max-wait=900 local=deploy-secrets
+juju-check-wait
+include config=manifests/secgroups
+include config=manifests/verify
diff --git a/lp-fetch-service/manifests/secgroups b/lp-fetch-service/manifests/secgroups
new file mode 100644
index 0000000..8c438ee
--- /dev/null
+++ b/lp-fetch-service/manifests/secgroups
@@ -0,0 +1 @@
+script config=utils/custom-secgroups.py SKIP_STAGES=devel
diff --git a/lp-fetch-service/manifests/verify b/lp-fetch-service/manifests/verify
new file mode 100644
index 0000000..f25f902
--- /dev/null
+++ b/lp-fetch-service/manifests/verify
@@ -0,0 +1,4 @@
+juju-check-wait
+# It occasionally takes a little while for all the servers to start
+# accepting connections.
+verify retry=3
diff --git a/lp-fetch-service/predeploy b/lp-fetch-service/predeploy
new file mode 100755
index 0000000..e6e2fbc
--- /dev/null
+++ b/lp-fetch-service/predeploy
@@ -0,0 +1,3 @@
+#! /bin/sh
+set -e
+exit 0
diff --git a/lp-fetch-service/utils b/lp-fetch-service/utils
new file mode 120000
index 0000000..468ba70
--- /dev/null
+++ b/lp-fetch-service/utils
@@ -0,0 +1 @@
+../utils
\ No newline at end of file
diff --git a/lp-fetch-service/verify b/lp-fetch-service/verify
new file mode 100755
index 0000000..df9e6ef
--- /dev/null
+++ b/lp-fetch-service/verify
@@ -0,0 +1,8 @@
+#! /bin/sh
+set -e
+
+TOP="${0%/*}"
+
+export EXTRA_SKIP_CHECKS="check_swap${EXTRA_SKIP_CHECKS:+|${EXTRA_SKIP_CHECKS}}"
+
+exec "$TOP/utils/verify"

Follow ups