mirror of
https://github.com/YunoHost-Apps/discourse_ynh.git
synced 2024-09-03 18:26:18 +02:00
Add ARM compatibility
This commit is contained in:
parent
ffa7684217
commit
3669f20dd0
5 changed files with 39 additions and 6 deletions
|
@ -11,6 +11,7 @@ Requires=discourse-sidekiq.service
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__
|
WorkingDirectory=__FINALPATH__
|
||||||
|
Environment=__ADDITIONAL_ENV__
|
||||||
Environment=RAILS_ENV=production
|
Environment=RAILS_ENV=production
|
||||||
ExecStart=__RBENVROOT__/shims/bundle exec puma --config config/puma.rb -e production
|
ExecStart=__RBENVROOT__/shims/bundle exec puma --config config/puma.rb -e production
|
||||||
ExecStop=__RBENVROOT__/shims/bundle exec pumactl stop
|
ExecStop=__RBENVROOT__/shims/bundle exec pumactl stop
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
# maximum file upload size (keep up to date when changing the corresponding site setting)
|
# maximum file upload size (keep up to date when changing the corresponding site setting)
|
||||||
client_max_body_size 10m;
|
client_max_body_size 10m;
|
||||||
|
|
||||||
|
# extend timeouts
|
||||||
|
proxy_connect_timeout 600;
|
||||||
|
proxy_send_timeout 600;
|
||||||
|
proxy_read_timeout 600;
|
||||||
|
send_timeout 600;
|
||||||
|
|
||||||
# path to discourse's public directory
|
# path to discourse's public directory
|
||||||
set $public __FINALPATH__/public/;
|
set $public __FINALPATH__/public/;
|
||||||
|
|
||||||
|
|
|
@ -184,9 +184,22 @@ chown -R $app: $final_path
|
||||||
gem install bundler
|
gem install bundler
|
||||||
# Install without documentation
|
# Install without documentation
|
||||||
exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc")
|
exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc")
|
||||||
|
# If on ARM architecture, define the platform specificly to retrieve binaries
|
||||||
|
# for libv8 because it currently doesn't compile on ARM devices
|
||||||
|
if [ -n "$(uname -m | grep arm)" ] ; then
|
||||||
|
exec_login_as $app bundle config specific_platform arm-linux
|
||||||
|
fi
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
exec_login_as $app MAKEFLAGS=-j2 bundle install --jobs 2 --path vendor/bundle --with development
|
exec_login_as $app MAKEFLAGS=-j2 bundle install --jobs 2 --path vendor/bundle --with development
|
||||||
|
|
||||||
|
# On ARM architecture, replace bundled libpsl by system native libpsl
|
||||||
|
# because the provided binary isn't compatible
|
||||||
|
if [ -n "$(uname -m | grep arm)" ] ; then
|
||||||
|
(cd $final_path/vendor/bundle/ruby/*/gems/mini_suffix-*/vendor
|
||||||
|
rm libpsl.so
|
||||||
|
ln -s $(ldconfig -p | grep libpsl | awk 'END {print $NF}') libpsl.so)
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SIDEKIQ
|
# SETUP SIDEKIQ
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -255,6 +268,16 @@ patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch)
|
||||||
ynh_replace_string "__RBENVROOT__" "$RBENV_ROOT" "../conf/discourse-puma.service"
|
ynh_replace_string "__RBENVROOT__" "$RBENV_ROOT" "../conf/discourse-puma.service"
|
||||||
ynh_replace_string "__RBENVROOT__" "$RBENV_ROOT" "../conf/discourse-sidekiq.service"
|
ynh_replace_string "__RBENVROOT__" "$RBENV_ROOT" "../conf/discourse-sidekiq.service"
|
||||||
|
|
||||||
|
# We assume for the moment that ARM devices are only dual core, so
|
||||||
|
# we restrict the number of workers to 2 (the default is 4)
|
||||||
|
if [ -n "$(uname -m | grep arm)" ] ; then
|
||||||
|
additional_env="NUM_WEBS=2"
|
||||||
|
else
|
||||||
|
additional_env=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_replace_string "__ADDITIONAL_ENV__" "$additional_env" "../conf/discourse-puma.service"
|
||||||
|
|
||||||
ynh_add_systemd_config $app-puma discourse-puma.service
|
ynh_add_systemd_config $app-puma discourse-puma.service
|
||||||
ynh_add_systemd_config $app-sidekiq discourse-sidekiq.service
|
ynh_add_systemd_config $app-sidekiq discourse-sidekiq.service
|
||||||
|
|
||||||
|
@ -312,5 +335,4 @@ systemctl reload nginx
|
||||||
# Wait for discourse-puma to be fully started
|
# Wait for discourse-puma to be fully started
|
||||||
# As discourse-sidekiq is a dependency, it is automatically started before
|
# As discourse-sidekiq is a dependency, it is automatically started before
|
||||||
ynh_check_starting_systemd "Use Ctrl-C to stop" "$app-puma" "120"
|
ynh_check_starting_systemd "Use Ctrl-C to stop" "$app-puma" "120"
|
||||||
# Additional pause to avoid 502 errors in package_check after reinstall...
|
|
||||||
sleep 120s
|
|
||||||
|
|
|
@ -129,5 +129,3 @@ ynh_check_starting_systemd "Use Ctrl-C to stop" "$app-puma" "120"
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
# Additional pause to avoid 502 errors in package_check after reinstall...
|
|
||||||
sleep 120s
|
|
||||||
|
|
|
@ -164,6 +164,13 @@ gem install bundler
|
||||||
exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc"
|
exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc"
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
exec_login_as $app bundle install --path vendor/bundle --with development)
|
exec_login_as $app bundle install --path vendor/bundle --with development)
|
||||||
|
# On ARM architecture, replace bundled libpsl by system native libpsl
|
||||||
|
# because the provided binary isn't compatible
|
||||||
|
if [ -n "$(uname -m | grep arm)" ] ; then
|
||||||
|
(cd $final_path/vendor/bundle/ruby/*/gems/mini_suffix-*/vendor
|
||||||
|
rm libpsl.so
|
||||||
|
ln -s $(ldconfig -p | grep libpsl | awk 'END {print $NF}') libpsl.so)
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SIDEKIQ
|
# SETUP SIDEKIQ
|
||||||
|
@ -210,5 +217,4 @@ systemctl reload nginx
|
||||||
# Wait for discourse-puma to be fully started
|
# Wait for discourse-puma to be fully started
|
||||||
# As discourse-sidekiq is a dependency, it is automatically started before
|
# As discourse-sidekiq is a dependency, it is automatically started before
|
||||||
ynh_check_starting_systemd "Use Ctrl-C to stop" "$app-puma" "120"
|
ynh_check_starting_systemd "Use Ctrl-C to stop" "$app-puma" "120"
|
||||||
# Additional pause to avoid 502 errors in package_check after reinstall...
|
|
||||||
sleep 120s
|
|
||||||
|
|
Loading…
Reference in a new issue