mirror of
https://github.com/YunoHost-Apps/plume_ynh.git
synced 2024-09-03 20:15:54 +02:00
Switch to build
This commit is contained in:
parent
ff5cdebba0
commit
688b85b4c7
7 changed files with 117 additions and 23 deletions
81
conf/Cargo.toml
Normal file
81
conf/Cargo.toml
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
[package]
|
||||||
|
authors = ["Plume contributors"]
|
||||||
|
name = "plume"
|
||||||
|
version = "0.3.0"
|
||||||
|
repository = "https://github.com/Plume-org/Plume"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
activitypub = "0.1.3"
|
||||||
|
askama_escape = "0.1"
|
||||||
|
atom_syndication = "0.6"
|
||||||
|
canapi = "0.2"
|
||||||
|
colored = "1.7"
|
||||||
|
dotenv = "0.13"
|
||||||
|
gettext = { git = "https://github.com/Plume-org/gettext/", rev = "294c54d74c699fbc66502b480a37cc66c1daa7f3" }
|
||||||
|
gettext-macros = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
|
||||||
|
gettext-utils = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
|
||||||
|
guid-create = "0.1"
|
||||||
|
heck = "0.3.0"
|
||||||
|
lettre = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" }
|
||||||
|
lettre_email = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" }
|
||||||
|
num_cpus = "1.0"
|
||||||
|
rocket = "0.4.0"
|
||||||
|
rocket_contrib = { version = "0.4.0", features = ["json"] }
|
||||||
|
rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" }
|
||||||
|
rpassword = "2.0"
|
||||||
|
runtime-fmt = "0.3.0"
|
||||||
|
scheduled-thread-pool = "0.2.0"
|
||||||
|
serde = "1.0"
|
||||||
|
serde_json = "1.0"
|
||||||
|
serde_qs = "0.4"
|
||||||
|
validator = "0.8"
|
||||||
|
validator_derive = "0.8"
|
||||||
|
webfinger = "0.3.1"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "plume"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
|
[dependencies.chrono]
|
||||||
|
features = ["serde"]
|
||||||
|
version = "0.4"
|
||||||
|
|
||||||
|
[dependencies.ctrlc]
|
||||||
|
features = ["termination"]
|
||||||
|
version = "3.1.1"
|
||||||
|
|
||||||
|
[dependencies.diesel]
|
||||||
|
features = ["r2d2", "chrono"]
|
||||||
|
version = "*"
|
||||||
|
|
||||||
|
[dependencies.multipart]
|
||||||
|
default-features = false
|
||||||
|
features = ["server"]
|
||||||
|
version = "0.16"
|
||||||
|
|
||||||
|
[dependencies.plume-api]
|
||||||
|
path = "plume-api"
|
||||||
|
|
||||||
|
[dependencies.plume-common]
|
||||||
|
path = "plume-common"
|
||||||
|
|
||||||
|
[dependencies.plume-models]
|
||||||
|
path = "plume-models"
|
||||||
|
|
||||||
|
[dependencies.rocket_csrf]
|
||||||
|
git = "https://github.com/fdb-hiroshima/rocket_csrf"
|
||||||
|
rev = "4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
ructe = "0.5.6"
|
||||||
|
rsass = "0.9"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["postgres"]
|
||||||
|
postgres = ["plume-models/postgres", "diesel/postgres"]
|
||||||
|
sqlite = ["plume-models/sqlite", "diesel/sqlite"]
|
||||||
|
debug-mailer = []
|
||||||
|
test = []
|
||||||
|
|
||||||
|
[workspace]
|
||||||
|
members = ["plume-api", "plume-cli", "plume-models", "plume-common", "plume-front"]
|
|
@ -2,5 +2,5 @@ SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.3.0-alpha-2/pl
|
||||||
SOURCE_SUM=e0c33a38367a5428606ae7bf8524c325edea09fdb4511c80a7aa8f4eb8f30905
|
SOURCE_SUM=e0c33a38367a5428606ae7bf8524c325edea09fdb4511c80a7aa8f4eb8f30905
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=false
|
||||||
SOURCE_FILENAME=
|
SOURCE_FILENAME=
|
|
@ -5,7 +5,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config openssl"
|
pkg_dependencies="postgresql postgresql-contrib"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
14
scripts/detect_arch
Normal file
14
scripts/detect_arch
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -n "$(uname -m | grep x86_64)" ]; then
|
||||||
|
architecture="x86-64"
|
||||||
|
elif [ -n "$(uname -m | grep 86)" ]; then
|
||||||
|
architecture="i386"
|
||||||
|
elif [ -n "$(uname -m | grep arm)" ]; then
|
||||||
|
architecture="arm"
|
||||||
|
elif [ -n "$(uname -m | grep aarch64)" ]; then
|
||||||
|
architecture="arm"
|
||||||
|
else
|
||||||
|
ynh_die "Unable to detect your achitecture, please open a bug describing \
|
||||||
|
your hardware and the result of the command \"uname -m\"." 1
|
||||||
|
fi
|
|
@ -7,6 +7,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source detect_arch
|
||||||
source ynh_systemd_action
|
source ynh_systemd_action
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -101,10 +102,20 @@ ynh_print_info "Setting up source files ..."
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path/$app"
|
ynh_setup_source "$final_path/$app" $architecture
|
||||||
|
|
||||||
# Create the media directory, where uploads will be stored
|
# Create the media directory, where uploads will be stored
|
||||||
mkdir $final_path/media
|
mkdir -p $final_path/media
|
||||||
|
|
||||||
|
# Create the cargo directory
|
||||||
|
mkdir -p $final_path/.cargo/bin
|
||||||
|
|
||||||
|
# Move binaries
|
||||||
|
mv $final_path/$app/bin/* $final_path/.cargo/bin/
|
||||||
|
chmod +x $final_path/.cargo/bin/*
|
||||||
|
|
||||||
|
# Remove empty bin directory
|
||||||
|
ynh_secure_remove $final_path/$app/bin/
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -136,7 +147,7 @@ chown -R "$app":"$app" "/var/log/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# setup application config
|
# setup application config
|
||||||
sudo cp "../conf/.env" "$final_path/$app/.env"
|
cp "../conf/.env" "$final_path/$app/.env"
|
||||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/$app/.env"
|
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/$app/.env"
|
||||||
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/$app/.env"
|
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/$app/.env"
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/.env"
|
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/.env"
|
||||||
|
@ -147,21 +158,16 @@ ynh_replace_string "__SECRET_KEY__" "$secret_key" "$final_path/$app/.env"
|
||||||
# MAKE SETUP
|
# MAKE SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Fix missing Cargo.toml
|
||||||
|
cp "../conf/Cargo.toml" "$final_path/$app/Cargo.toml"
|
||||||
|
|
||||||
# Set right permissions
|
# Set right permissions
|
||||||
chown -R "$app":"$app" $final_path
|
chown -R "$app":"$app" $final_path
|
||||||
|
|
||||||
# Install
|
|
||||||
pushd $final_path
|
|
||||||
sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=nightly'
|
|
||||||
popd
|
|
||||||
|
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
sudo -u "$app" env PATH=$PATH cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0'
|
|
||||||
sudo -u "$app" env PATH=$PATH diesel migration run
|
sudo -u "$app" env PATH=$PATH diesel migration run
|
||||||
sudo -u "$app" env PATH=$PATH cargo install --no-default-features --features postgres
|
|
||||||
sudo -u "$app" env PATH=$PATH cargo install --no-default-features --features postgres --path plume-cli
|
|
||||||
|
|
||||||
# Add new instance
|
# Add new instance
|
||||||
if [ $registration -eq 1 ]
|
if [ $registration -eq 1 ]
|
||||||
|
|
|
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
read -p "key"
|
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source detect_arch
|
||||||
source ynh_systemd_action
|
source ynh_systemd_action
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -104,7 +105,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
ynh_print_info "Upgrading source files..."
|
ynh_print_info "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path/$app"
|
ynh_setup_source "$final_path/$app" $architecture
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -155,16 +156,9 @@ fi
|
||||||
# Set right permissions
|
# Set right permissions
|
||||||
chown -R "$app":"$app" $final_path
|
chown -R "$app":"$app" $final_path
|
||||||
|
|
||||||
# Install
|
|
||||||
pushd $final_path
|
|
||||||
sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=nightly'
|
|
||||||
popd
|
|
||||||
|
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
sudo -u "$app" env PATH=$PATH cargo install --no-default-features --features postgres --force
|
|
||||||
sudo -u "$app" env PATH=$PATH cargo install --no-default-features --features postgres --path plume-cli --force
|
|
||||||
sudo -u "$app" env PATH=$PATH diesel migration run
|
sudo -u "$app" env PATH=$PATH diesel migration run
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue