Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to tldraw v2 (complete upstream revamp) #116

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app.
- Multiplayer mode (iFrame compatible)


**Shipped version:** 1.24.5~ynh3
**Shipped version:** 2.3.0~ynh1

**Demo:** <https://tldraw.com>

Expand Down
2 changes: 1 addition & 1 deletion README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app.
- Multiplayer mode (iFrame compatible)


**Versión actual:** 1.24.5~ynh3
**Versión actual:** 2.3.0~ynh1

**Demo:** <https://tldraw.com>

Expand Down
2 changes: 1 addition & 1 deletion README_eu.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app.
- Multiplayer mode (iFrame compatible)


**Paketatutako bertsioa:** 1.24.5~ynh3
**Paketatutako bertsioa:** 2.3.0~ynh1

**Demoa:** <https://tldraw.com>

Expand Down
2 changes: 1 addition & 1 deletion README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TLDraw est une petite application de dessin.
- Prêt pour PWA
- Mode multijoueur (compatible iFrame)

**Version incluse :** 1.24.5~ynh3
**Version incluse :** 2.3.0~ynh1

**Démo :** <https://tldraw.com>

Expand Down
2 changes: 1 addition & 1 deletion README_gl.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app.
- Multiplayer mode (iFrame compatible)


**Versión proporcionada:** 1.24.5~ynh3
**Versión proporcionada:** 2.3.0~ynh1

**Demo:** <https://tldraw.com>

Expand Down
2 changes: 1 addition & 1 deletion README_zh_Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app.
- Multiplayer mode (iFrame compatible)


**分发版本:** 1.24.5~ynh3
**分发版本:** 2.3.0~ynh1

**演示:** <https://tldraw.com>

Expand Down
2 changes: 1 addition & 1 deletion conf/systemd.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=network.target
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__INSTALL_DIR__/apps/www/
WorkingDirectory=__INSTALL_DIR__/sources/apps/www/
Environment="NODE_ENV=production"
Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=yarn start --port=__PORT__
Expand Down
32 changes: 6 additions & 26 deletions manifest.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json

packaging_format = 2

id = "tldraw"
name = "TLDraw"
description.en = "Tiny little drawing app"
description.fr = "Petite application de dessin"

version = "1.24.5~ynh3"
version = "2.3.0~ynh1"

maintainers = ["Raoul de Limezy"]

Expand Down Expand Up @@ -33,29 +35,13 @@ ram.runtime = "50M"
type = "group"
default = "visitors"

[install.publickey]
ask.en = "Liveblocks API Public Key"
ask.fr = "Clé publique de l'API Liveblocks"
help.en = "Multiplayer mode requires a Liveblocks API Public Key (you can get one for free at https://liveblocks.io). Don't input anything if you don't want multiplayer mode."
help.fr = "Le mode d'édition instantanée requiert une clef publique d'API Liveblocks (vous pouvez en obtenir une gratuitement sur ttps://liveblocks.io). Ne mettez rien si vous ne souhaitez pas de mode d'étition instantanée."
type = "string"
optional = true

[install.secretkey]
ask.en = "Liveblocks API Secret Key"
ask.fr = "Clé secrète de l'API Liveblocks"
help.en = "Multiplayer mode requires a Liveblocks API Secret Key (you can get one for free at https://liveblocks.io). Don't input anything if you don't want multiplayer mode."
help.fr = "Le mode d'édition instantanée requiert une clef secrete d'API Liveblocks (vous pouvez en obtenir une gratuitement sur ttps://liveblocks.io). Ne mettez rien si vous ne souhaitez pas de mode d'étition instantanée."
type = "string"
optional = true

[resources]
[resources.sources.main]
url = "https://github.com/tldraw/tldraw/archive/8e55e263bf45cb6d425178c638aec385ec01e62c.zip"
sha256 = "d090aac97266e043418ec34d46e722dd69c7dace4bd30f39afb9478eb21271d1"
url = "https://github.com/tldraw/tldraw/archive/refs/tags/v2.3.0.tar.gz"
sha256 = "7f66ab29a755ad085695730690b6be1337c08a727eff687163990d4ecca696d6"
# Disabled autoupdate for now because it's flooding with PRs which are failing the test
# The "multiplayer" patch needs to be fixed to be adapted to newer versions
#autoupdate.strategy = "latest_github_tag"
autoupdate.strategy = "latest_github_tag"

[resources.ports]

Expand All @@ -65,9 +51,3 @@ ram.runtime = "50M"

[resources.permissions]
main.url = "/"

[resources.apt]
packages = ""
extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main"
extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg"
extras.yarn.packages = "yarn"
4 changes: 1 addition & 3 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/bin/bash

#=================================================
# COMMON VARIABLES
#=================================================
# PHP APP SPECIFIC
#=================================================

NODEJS_VERSION=18
NODEJS_VERSION=20

#=================================================
# PERSONAL HELPERS
Expand Down
20 changes: 2 additions & 18 deletions scripts/backup
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
Expand All @@ -22,24 +20,16 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"

#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================

ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"

#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"

ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"

#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================

ynh_backup --src_path="/etc/logrotate.d/$app"

#=================================================
Expand All @@ -48,12 +38,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app"

ynh_backup --src_path="/var/log/$app/$app.log"

#=================================================
# BACKUP SYSTEMD
#=================================================

ynh_backup --src_path="/etc/systemd/system/$app.service"

#=================================================
# END OF SCRIPT
#=================================================
Expand Down
10 changes: 2 additions & 8 deletions scripts/change_url
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#!/bin/bash

#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================

source _common.sh
source /usr/share/yunohost/helpers

#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
Expand All @@ -25,14 +21,12 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --

ynh_change_url_nginx_config

#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1

ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"

#=================================================
# END OF SCRIPT
Expand Down
79 changes: 25 additions & 54 deletions scripts/install
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
Expand All @@ -12,94 +10,67 @@ source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression --message="Installing NodeJS..." --weight=1

# Install nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_nodejs --nodejs_version="$NODEJS_VERSION"

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1

ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/sources"
mkdir -p "$install_dir/bin"

chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"

#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1

# Create a dedicated NGINX config
ynh_add_nginx_config

#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Patching multiplayer file..." --weight=1

ynh_secure_remove --file="$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx"
ynh_add_config --template="../conf/MultiplayerMenu.tsx" --destination="$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx"

chmod 400 "$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx"
chown $app:$app "$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx"
chown -R "$app:www-data" "$install_dir"

#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
# ynh_script_progression --message="Adding a configuration file..." --weight=1

ynh_add_config --template="../conf/.env" --destination="$install_dir/apps/www/.env"

chmod 400 "$install_dir/apps/www/.env"
chown $app:$app "$install_dir/apps/www/.env"
# ynh_add_config --template=".env" --destination="$install_dir/apps/www/.env"
# chmod 400 "$install_dir/apps/www/.env"
# chown "$app:$app" "$install_dir/apps/www/.env"

#=================================================
# BUILD YARN DEPENDENCIES
#=================================================

pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build
ynh_use_nodejs
ynh_exec_as "$app" env "$ynh_node_load_PATH" corepack enable --install-directory "$install_dir/bin"

pushd "$install_dir/sources"
ynh_exec_warn_less ynh_exec_as "$app" env COREPACK_ENABLE_DOWNLOAD_PROMPT=0 "$ynh_node_load_PATH" "$install_dir/bin/yarn" cache clean
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$install_dir/bin/yarn" install --network-timeout 1000000000
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$install_dir/bin/yarn" cache clean
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$install_dir/bin/yarn" build
popd

#=================================================
# SETUP SYSTEMD
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1

# Create a dedicated NGINX config
ynh_add_nginx_config

# Create a dedicated systemd config
ynh_add_systemd_config

#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
yunohost service add "$app" --description="A tiny little drawing app" --log="/var/log/$app/$app.log"

# Use logrotate to manage application logfile(s)
ynh_use_logrotate

#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1

yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log"

#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1

# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"

#=================================================
# END OF SCRIPT
Expand Down
15 changes: 4 additions & 11 deletions scripts/remove
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
Expand All @@ -10,16 +8,13 @@ source _common.sh
source /usr/share/yunohost/helpers

#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1

# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi

# Remove the dedicated systemd config
Expand All @@ -34,8 +29,6 @@ ynh_remove_nginx_config
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config

# Remove the log files

#=================================================
# END OF SCRIPT
#=================================================
Expand Down
Loading