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

[enh] Create user & administrator after install

This commit is contained in:
magikcypress 2017-04-30 03:00:02 +02:00
parent 7a56608ac7
commit 6bd9e8e222
3 changed files with 27 additions and 2 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
@ -178,6 +181,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