1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mastodon_ynh.git synced 2024-09-03 19:46:02 +02:00

Merge pull request #8 from YunoHost-Apps/master

[enh] Create admin on install
This commit is contained in:
nemsia 2017-04-30 13:59:58 +02:00 committed by GitHub
commit 4aa9a1d170
6 changed files with 27 additions and 5 deletions

View file

@ -78,3 +78,10 @@ After installation, you can create an account manually on Mastodon from your bro
You can't install Mastodon in subdirectory, you must use a domain or subdomain for this application.
It seems important to close the inscriptions for your Mastodon, so that it remains a private body. We invite you to block remote malicious instances from the administration interface. You can also add text on your home page.
## TODO
- [x] Fix upgrade
- [x] [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed)
- [ ] Fix restore
- [ ] Install from a release

View file

@ -44,8 +44,8 @@
"name": "passwd",
"type": "password",
"ask": {
"en": "Enter password of this administrator",
"fr": "Ajouter le mot de passe pour cette administrateur"
"en": "Enter password of this administrator ≥ 8 character",
"fr": "Ajouter le mot de passe pour cette administrateur ≥ 8 charactères"
},
"example": "adminpassword"
},

View file

@ -33,6 +33,9 @@ ynh_app_setting_set $app admin $admin_mastodon
ynh_app_setting_set $app pass $admin_pass
ynh_app_setting_set $app language $language
[[ ${#admin_pass} -gt 8 ]] || ynh_die \
"The password is too weak, it must be longer than 8 characters"
# Create user unix
sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login
@ -182,6 +185,21 @@ sudo yunohost service add mastodon-web
sudo yunohost service add mastodon-sidekiq
sudo yunohost service add mastodon-streaming
# Create user
sudo su - $app <<UCOMMANDS
pushd ~/live
RAILS_ENV=production bundle exec rails c
account = Account.create!(username: '$admin_mastodon')
user = User.create!(email: '$admin_mastodon@$domain', password: '$admin_pass', account: account)
UCOMMANDS
# Create administrator & confirm user
sudo su - $app <<ACOMMANDS
pushd ~/live
RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_mastodon
RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon@$domain
ACOMMANDS
# Copy nginx config
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf

View file

@ -1 +0,0 @@
mastodon-1.1.2

View file

@ -1 +0,0 @@
c10055d4250e51eaaf16c78a50390839 mastodon-1.1.2.zip

View file

@ -1 +0,0 @@
https://github.com/tootsuite/mastodon/archive/v1.1.2.zip