mirror of
https://git.qoto.org/m33/misskey-admin-scripts-n-tips.git
synced 2024-10-22 15:09:06 +00:00
upload scripts
This commit is contained in:
parent
24e8a931c7
commit
d71e496e69
3 changed files with 123 additions and 0 deletions
34
start_misskey.sh
Executable file
34
start_misskey.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Start misskey instance
|
||||
# Rotate logs
|
||||
#
|
||||
|
||||
### You will need to adjust Paths ###
|
||||
# Store containers log
|
||||
LOG=/var/log/docker
|
||||
# Misskey (git) code directory
|
||||
CODE=/usr/local/misskey/code
|
||||
# Misskey (containers volumes) data directory
|
||||
DATA=/usr/local/misskey/data
|
||||
# Docker compose file name
|
||||
COMPOSE=docker-compose.yml
|
||||
###
|
||||
|
||||
DT=`date +%s`
|
||||
mkdir -p $LOG || exit 1
|
||||
|
||||
# Rotate logs if needed on each (re)start, cleanup with tmpreaper or something
|
||||
if [ -f $LOG/misskey.log ]; then
|
||||
mv $LOG/misskey.log $LOG/misskey.log.$DT
|
||||
nice gzip $LOG/misskey.log.$DT & 1>/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ ! -d $CODE ] || [ ! -d $DATA ]; then
|
||||
echo "Error, you may need to adjust path in this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[start_misskey] by $USER..." 1>$LOG/misskey.log
|
||||
nohup docker-compose --project-directory=$DATA --file $DATA/$COMPOSE up 1>>$LOG/misskey.log 2>&1 &
|
||||
exit $?
|
26
stop_misskey.sh
Executable file
26
stop_misskey.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# stop misskey instance using docker commands
|
||||
#
|
||||
|
||||
### You will need to adjust Paths ###
|
||||
# Store containers log
|
||||
LOG=/var/log/docker/misskey.log
|
||||
# Misskey (git) code directory
|
||||
CODE=/usr/local/misskey/code
|
||||
# Misskey (containers volumes) data directory
|
||||
DATA=/usr/local/misskey/data
|
||||
# Docker compose file name
|
||||
COMPOSE=docker-compose.yml
|
||||
###
|
||||
|
||||
if [ ! -d $CODE ] || [ ! -d $DATA ]; then
|
||||
echo "Error, you may need to adjust path in this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[stop_misskey] by $USER started..." >> $LOG
|
||||
docker-compose --project-directory=$DATA -f $DATA/$COMPOSE stop 1>>$LOG 2>&1
|
||||
RV=$?
|
||||
echo "[stop_misskey] done ($RV)" >> $LOG
|
||||
exit $RV
|
63
update_misskey_git.sh
Executable file
63
update_misskey_git.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# semi automatic misskey updates
|
||||
# This script may trash your instance, use with caution, make backups...
|
||||
#
|
||||
|
||||
### You will need to adjust Paths ###
|
||||
# Store containers log
|
||||
LOG=/var/log/docker/misskey.log
|
||||
# Misskey (git) code directory
|
||||
CODE=/usr/local/misskey/code
|
||||
# Misskey (containers volumes) data directory
|
||||
DATA=/usr/local/misskey/data
|
||||
# Docker compose file name
|
||||
COMPOSE=docker-compose.yml
|
||||
# Backup destination directory
|
||||
DST=/usr/local/backup
|
||||
# Automatically stop, update and start the running instance
|
||||
AUTOUPDATE=0
|
||||
###
|
||||
|
||||
if [ ! -d $CODE ] || [ ! -d $DATA ]; then
|
||||
echo "Error, you may need to adjust path in this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Take some care
|
||||
echo "Backing up current code... (you really should have done yourself a data backup before upgrading, something like backup_postgres.sh)"
|
||||
tar -czf $DST/backup-code.tgz $CODE
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: something went wrong during backup..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Updating codebase with git..."
|
||||
#git stash
|
||||
#git checkout master
|
||||
#git pull
|
||||
#git submodule update --init
|
||||
#git stash pop
|
||||
echo "Building new images... (it will take some time)"
|
||||
docker-compose --project-directory=$DATA --file $DATA/$COMPOSE build
|
||||
|
||||
#sudo docker-compose stop && sudo docker-compose up -d
|
||||
if [ $AUTOUPDATE -eq 0 ]; then
|
||||
echo "Stop and restart the instance using:"
|
||||
echo "stop_misskey.sh"
|
||||
echo "start_misskey.sh"
|
||||
else
|
||||
echo "Automatically updating the instance, fingers crossed"
|
||||
stop_misskey.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: something went wrong when stopping the instance"
|
||||
exit 1
|
||||
fi
|
||||
start_misskey.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: something went wrong when starting the instance"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Reference in a new issue