summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuoi2022-11-10 01:26:53 +0800
committerKuoi2022-11-10 01:26:53 +0800
commit9dc1716def773c98a2f2bc8e6661e2326ce86066 (patch)
treed6b4771a0772f291e2186cd3abc660c6f36181f1
parent088ccf1c470537d208a7fe6d335f5676a57b9b91 (diff)
downloadaur-9dc1716def773c98a2f2bc8e6661e2326ce86066.tar.gz
plume: 0.7.2, polish
-rw-r--r--.SRCINFO25
-rw-r--r--.env.sample28
-rw-r--r--PKGBUILD68
-rw-r--r--config38
-rw-r--r--plume.install31
-rw-r--r--plume.service3
-rw-r--r--plume.sysusers (renamed from sysuser.conf)0
7 files changed, 113 insertions, 80 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 397b13399d69..5720774a198e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,23 +1,24 @@
pkgbase = plume
pkgdesc = Federated blogging application
- pkgver = 0.3.0a2
+ pkgver = 0.7.2
pkgrel = 1
url = https://joinplu.me/
install = plume.install
arch = x86_64
license = AGPL3
- makedepends = cargo
- depends = cargo-web
- depends = diesel_cli
- depends = postgresql
- source = plume-0.3.0a2.tar.gz::https://github.com/Plume-org/Plume/archive/0.3.0-alpha-2.tar.gz
- source = sysuser.conf
+ makedepends = rustup
+ makedepends = wasm-pack
+ depends = openssl
+ optdepends = postgresql: postgresql support
+ optdepends = sqlite3: sqlite support
+ backup = etc/plume/config
+ source = plume-0.7.2.tar.gz::https://github.com/Plume-org/Plume/archive/refs/tags/0.7.2.tar.gz
+ source = plume.sysusers
source = plume.service
- source = config
- md5sums = 533231959873a2a7c7b416b8df0eaf0a
+ source = .env.sample
+ md5sums = 75d75d08656f707c1ea7b55ce34d8102
md5sums = ebfcfb05844a25ff281317af9b64f8bb
- md5sums = c4e95f7b575ea1be0dd905e64f97eb9b
- md5sums = 92c6867252e9276d5798c30858ed0278
+ md5sums = d7d282ac020ebf59c7c56b31b41160ef
+ md5sums = 939c960f67f2b859b48f96223bd6b74e
pkgname = plume
-
diff --git a/.env.sample b/.env.sample
new file mode 100644
index 000000000000..7047654a0509
--- /dev/null
+++ b/.env.sample
@@ -0,0 +1,28 @@
+# The address of the database
+# (replace USER, PASSWORD, PORT and DATABASE_NAME with your values)
+#
+# If you are using SQlite, use the full path of the database file (`plume.db` for instance)
+# Windows user's paths are backslashes, change them to forward slashes
+#DATABASE_URL=/etc/path/to/Plume/plume.db
+DATABASE_URL=postgres://USER:PASSWORD@IP:PORT/DATABASE_NAME
+
+# For PostgreSQL: migrations/postgres
+# For SQlite: migrations/sqlite
+MIGRATION_DIRECTORY=migrations/postgres
+
+# The domain on which your instance will be available
+BASE_URL=plu.me
+
+# Secret key used for private cookies and CSRF protection
+# You can generate one with `openssl rand -base64 32`
+ROCKET_SECRET_KEY=
+
+# Mail settings
+# If you don't want to setup a mail server and/or address for plume
+# and don't plan to use the "password reset" feature,
+# you can comment these lines.
+MAIL_SERVER=smtp.example.org
+MAIL_USER=example
+MAIL_PASSWORD=123456
+MAIL_HELO_NAME=example.org
+MAIL_ADDRESS=from@example.org
diff --git a/PKGBUILD b/PKGBUILD
index 0c2c432efdfe..10748a32a03f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,44 +1,66 @@
# Maintainer: Jiuyang Liu <liujiuyang1994@gmail.com>
pkgname=plume
-pkgver=0.3.0a2
+_pkgname=Plume
+pkgver=0.7.2
pkgrel=1
pkgdesc='Federated blogging application'
arch=(x86_64)
url='https://joinplu.me/'
license=(AGPL3)
-depends=(cargo-web diesel_cli postgresql)
-makedepends=(cargo)
-# TODO: fix the alpha version
-source=("$pkgname-$pkgver.tar.gz::https://github.com/Plume-org/Plume/archive/0.3.0-alpha-2.tar.gz"
- "sysuser.conf"
+depends=(openssl)
+makedepends=(rustup wasm-pack)
+optdepends=('postgresql: postgresql support'
+ 'sqlite3: sqlite support')
+backup=('etc/plume/config')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/Plume-org/Plume/archive/refs/tags/${pkgver}.tar.gz"
+ "plume.sysusers"
"plume.service"
- "config")
+ ".env.sample")
install=$pkgname.install
-md5sums=('533231959873a2a7c7b416b8df0eaf0a'
+md5sums=('75d75d08656f707c1ea7b55ce34d8102'
'ebfcfb05844a25ff281317af9b64f8bb'
- 'c4e95f7b575ea1be0dd905e64f97eb9b'
- '92c6867252e9276d5798c30858ed0278')
+ 'd7d282ac020ebf59c7c56b31b41160ef'
+ '939c960f67f2b859b48f96223bd6b74e')
+
+prepare(){
+ cd $_pkgname-$pkgver
+ sed -i '$a\\n' Cargo.toml
+ sed -i '$a\[package.metadata.wasm-pack.profile.release]' Cargo.toml
+ sed -i '$a\wasm-opt = false' Cargo.toml
+}
build() {
- cd "Plume-0.3.0-alpha-2"
- cargo web deploy -p plume-front
- # only use postgres as database backend
- cargo build --release --features postgres
- cd plume-cli
- cargo build --release --features postgres
+ cd $_pkgname-$pkgver
+ # build the font-end
+ rustup target add wasm32-unknown-unknown
+ #env PATH=$HOME/.cargo/bin/:$PATH wasm-pack build --target web --release plume-front
+ wasm-pack build --target web --release plume-front
+
+ # build the back-end
+ cargo install --no-default-features --features postgres --path .
+ cargo install --no-default-features --features postgres --path plume-cli
+
}
package() {
- install -d $pkgdir/etc/plume
- install -Dm644 "config" "$pkgdir/usr/share/webapps/plume/.env"
- install -Dm644 "sysuser.conf" "$pkgdir/usr/lib/sysusers.d/plume.conf"
+ # config files
+ install $srcdir/.env.sample "$pkgdir"/etc/plume/config
+ ln -s "/usr/share/webapps/plume/.env" "$pkgdir/etc/plume/config"
+
+ # systemd related
+ install -Dm644 "plume.sysusers" "$pkgdir/usr/lib/sysusers.d/plume.conf"
install -Dm644 "plume.service" "$pkgdir/usr/lib/systemd/system/plume.service"
- cd "Plume-0.3.0-alpha-2"
+
+ cd $_pkgname-$pkgver
+
+ # binary
install -Dm755 "target/release/plume" "$pkgdir/usr/bin/plume"
install -Dm755 "target/release/plm" "$pkgdir/usr/bin/plm"
- install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
- cp -r "migrations/postgres" "$pkgdir/usr/share/webapps/plume/migrations"
+ ln -s /usr/bin/plume $pkgdir/usr/share/webapps/plume
+ ln -s /usr/bin/plm $pkgdir/usr/share/webapps/plm
+
+ # webpage
cp -r "static" "$pkgdir/usr/share/webapps/plume"
- ln -s "/usr/share/webapps/plume/.env" "$pkgdir/etc/plume/config"
+
}
diff --git a/config b/config
deleted file mode 100644
index 4a91cb86d97e..000000000000
--- a/config
+++ /dev/null
@@ -1,38 +0,0 @@
-# the domain name, or IP and port on which Plume is listening. It is used in all federation-related code.
-BASE_URL=example.com
-
-# the URL of the database used by Plume (postgres://plume:plume@localhost/plume by default with PostgreSQL, plume.db with SQlite)
-DATABASE_URL=postgres://plume:plume@localhost/plume
-
-# The folder that stores the migration files for the database, migrations/postgres for PostgreSQL databases or migrations/sqlite for SQlite databases.
-MIGRATION_DIRECTORY=/usr/share/webapps/plume/migrations
-
-# The directory where the search index will be saved (search_index by default).
-SEARCH_INDEX=/usr/share/webapps/plume/search_index
-
-# the adress on which Plume should listen (0.0.0.0 by default).
-#ROCKET_ADDRESS=
-
-# the port on which Plume should listen (7878 by default).
-#ROCKET_PORT=
-
-# key used to sign private cookies and for CSRF protection. If it is not set, it will be regenerated everytime you restart Plume, meaning that all your users will get disconnected. You can generate one with openssl rand -base64 32.
-#ROCKET_SECRET_KEY=
-
-# the SMTP server to connect to.
-#MAIL_SERVER=
-# the username of the user that sends emails.
-#MAIL_USER=
-# its password.
-#MAIL_PASSWORD=
-# the name sent during EHLO/HELO.
-#MAIL_HELO_NAME=
-
-# it will change the logo in the header, the favicon, and the webmanifest (used when pinning a website to home screen on mobile phones). It is recommended to use SVG files when possible.
-#PLUME_LOGO=
-
-# that can change the favicon, if you want to use an image that is not PLUME_LOGO.
-#PLUME_LOGO_FAVICON=
-
-#where size is one of 48, 72, 96, 144, 160, 192, 256 or 512. It will change the icon to use in the webmanifest for the given size. You can of course specify it multiple times, with different sizes.
-#PLUME_LOGO_size=
diff --git a/plume.install b/plume.install
index 4ba051784670..af0e7de2edfb 100644
--- a/plume.install
+++ b/plume.install
@@ -1,8 +1,27 @@
-post_install() {
- chown plume:plume /usr/share/webapps/plume -R
+pre_install(){
+ echo ""
+ echo "==> You must install postgresql or sqlite"
+ echo ""
}
-
-post_upgrade() {
- echo "Your need to upgrade database by runing ."
- echo "sudo -su plume diesel migration run"
+post_install() {
+ echo ""
+ echo "==> Firstly, you use set up the postgresql before use it: sudo -u postgres createuser -d -P plume_user && sudo -u postgres createdb -O plume_user plume_db"
+ echo ""
+ echo "==> Secondly, edit /etc/plume/config file based on what you set"
+ echo ""
+ echo "==> Finally, use the command to init the db"
+ echo ""
+ echo "==> cd /usr/share/webapps/plume && plm migration run && plm search init"
+ echo ""
+ echo "==> plm instance new --private --domain DOMAIN --name 'PLUME_NAME' -l 'LICENSE_NAME' (if you want to open registeration, without --private)"
+ echo ""
+ echo "==> plm users new --admin (create normal user without --admin)"
+ echo ""
+ echo "==> chown -R plume:plume /usr/share/webapps/plume"
+ echo ""
+ echo "==> to start and enable the service: systemctl start plume && systemctl enable plume"
+ echo ""
+ echo "Be careful to upgrade the postgresql db"
+ echo ""
+ echo "please read for more details: https://docs.joinplu.me/ for details"
}
diff --git a/plume.service b/plume.service
index 9b891b3ad0a4..92eb45aa89b2 100644
--- a/plume.service
+++ b/plume.service
@@ -4,10 +4,11 @@ Description=plume
[Service]
Type=simple
User=plume
+WorkingDirectory=/usr/share/webapps/plume/
ExecStart=/usr/bin/plume
-WorkingDirectory=/usr/lib/plume
TimeoutSec=30
Restart=always
[Install]
WantedBy=multi-user.target
+
diff --git a/sysuser.conf b/plume.sysusers
index cf03318ec8e3..cf03318ec8e3 100644
--- a/sysuser.conf
+++ b/plume.sysusers