diff --git a/conf/Cargo.toml b/conf/Cargo.toml new file mode 100644 index 0000000..0926cbc --- /dev/null +++ b/conf/Cargo.toml @@ -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"] diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 55eadbb..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/Plume-org/Plume/archive/0.3.0-alpha-2.tar.gz -SOURCE_SUM=88d31a7ff527132f5cf252b2f446bb42a13e01eec5b30cf877f63abf095988cd -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/arm.src b/conf/arm.src new file mode 100644 index 0000000..e85af71 --- /dev/null +++ b/conf/arm.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/YunoHost-Apps/plume_ynh/releases/download/0.3.0/plume-arm64-postgres.tar.gz +SOURCE_SUM=d6944c1b1dc0c8434dcbeffcd139fec22aa816c5d98bc2a5187bbce2740f2450 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= diff --git a/conf/x86-64.src b/conf/x86-64.src new file mode 100644 index 0000000..b38afa3 --- /dev/null +++ b/conf/x86-64.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.3.0-alpha-2/plume-postgres.tar.gz +SOURCE_SUM=e0c33a38367a5428606ae7bf8524c325edea09fdb4511c80a7aa8f4eb8f30905 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= diff --git a/scripts/_common.sh b/scripts/_common.sh index aa40270..c0220ac 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # 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 diff --git a/scripts/detect_arch b/scripts/detect_arch new file mode 100644 index 0000000..d82d3ca --- /dev/null +++ b/scripts/detect_arch @@ -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 diff --git a/scripts/install b/scripts/install index a9bfb3d..19a0943 100755 --- a/scripts/install +++ b/scripts/install @@ -7,6 +7,7 @@ #================================================= source _common.sh +source detect_arch source /usr/share/yunohost/helpers #================================================= @@ -14,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -100,10 +101,20 @@ ynh_print_info "Setting up source files ..." ynh_app_setting_set $app final_path $final_path # 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 -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 @@ -135,7 +146,7 @@ chown -R "$app":"$app" "/var/log/$app" #================================================= # 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_PWD__" "$db_pwd" "$final_path/$app/.env" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/.env" @@ -146,21 +157,16 @@ ynh_replace_string "__SECRET_KEY__" "$secret_key" "$final_path/$app/.env" # MAKE SETUP #================================================= +# Fix missing Cargo.toml +cp "../conf/Cargo.toml" "$final_path/$app/Cargo.toml" + # Set right permissions 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" 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 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 if [ $registration -eq 1 ] diff --git a/scripts/restore b/scripts/restore index c52b445..cf4f9fc 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - read -p "key" ynh_clean_check_starting } # Exit if an error occurs during the execution of the script diff --git a/scripts/upgrade b/scripts/upgrade index ad5ba88..f7098d7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,6 +7,7 @@ #================================================= source _common.sh +source detect_arch source /usr/share/yunohost/helpers #================================================= @@ -103,7 +104,7 @@ path_url=$(ynh_normalize_url_path $path_url) ynh_print_info "Upgrading source files..." # 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 @@ -154,16 +155,9 @@ fi # Set right permissions 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" 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 popd