Skip to content

Commit

Permalink
Merge pull request #13 from YunoHost/demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar authored Nov 5, 2024
2 parents bd62311 + 4396abf commit 9d931ab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
7 changes: 6 additions & 1 deletion image_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def main():
parser.add_argument(
"variants",
type=str,
choices=["build-and-lint", "before-install", "appci-only", "all"],
choices=["build-and-lint", "before-install", "appci-only", "all", "demo"],
)
args = parser.parse_args()

Expand Down Expand Up @@ -284,6 +284,11 @@ def main():
builder.run_script("appci")
builder.publish("appci")

if args.variants == "demo":
builder.start(builder.image_alias("before-install"))
builder.run_script("demo")
builder.publish("demo")

builder.clear()


Expand Down
29 changes: 27 additions & 2 deletions recipes
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function before_install()

# Download the YunoHost install script
INSTALL_SCRIPT="https://raw.githubusercontent.com/YunoHost/install_script/main/$DEBIAN_VERSION"
curl "$INSTALL_SCRIPT" -o install.sh
curl -L -s "$INSTALL_SCRIPT" -o install.sh

# Disable the install of yunohost itself, because we need this for the core CI
sed -i -E 's/(step\s+install_yunohost_packages)/#\1/' install.sh
Expand Down Expand Up @@ -118,7 +118,8 @@ function dev()
install_gitlab_runner_light

# Download and run the YunoHost install script
curl "https://raw.githubusercontent.com/YunoHost/install_script/main/$DEBIAN_VERSION" -o install.sh
INSTALL_SCRIPT="https://raw.githubusercontent.com/YunoHost/install_script/main/$DEBIAN_VERSION"
curl -L -s "$INSTALL_SCRIPT" -o install.sh
chmod +x install.sh
./install.sh -a -d "$RELEASE"
rm install.sh
Expand Down Expand Up @@ -167,6 +168,30 @@ function core_tests()
# python3 -m pip install -U "${CORE_TESTS_PIP_DEPENCENDIES[@]}"
}

function demo()
{
DOMAIN="demo.yunohost.org"

INSTALL_SCRIPT="https://raw.githubusercontent.com/YunoHost/install_script/main/$DEBIAN_VERSION"
curl -L -s "$INSTALL_SCRIPT" -o install.sh
chmod +x install.sh
./install.sh -a -d "$RELEASE"
rm install.sh

# Disable password strength check for convenience on the app CI
echo 'admin_strength: -1' >> /etc/yunohost/settings.yml
echo 'user_strength: -1' >> /etc/yunohost/settings.yml

yunohost tools postinstall --domain "$DOMAIN" --password "demo" --username "demo" --fullname "Demo user" --force-diskspace

APPS=(hextris nextcloud opensondage roundcube wallabag2 wordpress etherpad_mypads vaultwarden my_webapp freshrss yeswiki diagramsnet)
for APP in "${APPS[@]}"; do
yunohost app install "$APP" --force --args "domain=$DOMAIN&init_main_permission=visitors&admin=demo&path=/$APP&password=demo" || true
done

# TODO : tweak the user portal and admin to have the demo credentials displayed etc
}

function slimify()
{
apt_yes clean
Expand Down

0 comments on commit 9d931ab

Please sign in to comment.