mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-03 19:56:22 -07:00
Add script to get old release for migration testing
This commit is contained in:
parent
7e1e3b1662
commit
39d4fca721
3 changed files with 60 additions and 12 deletions
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"dbhost": "127.0.0.1:3306",
|
||||
"dbtype": "mysql",
|
||||
"dbusername": "gochan",
|
||||
"dbpassword": "gochan",
|
||||
"olddbname": "gochan_pre2021_db",
|
||||
"newdbname": "gochan",
|
||||
"oldchan": "pre2021",
|
||||
"tableprefix": "gc_"
|
||||
}
|
|
@ -3,8 +3,6 @@
|
|||
--
|
||||
|
||||
CREATE DATABASE gochan_pre2021_db;
|
||||
GRANT ALL PRIVILEGES ON gochan_pre2021_db.* TO 'gochan'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
USE gochan_pre2021_db;
|
||||
|
||||
CREATE TABLE `gc_announcements` (
|
||||
|
@ -190,3 +188,6 @@ INSERT INTO `gc_info` VALUES ('version','2.12.0');
|
|||
INSERT INTO `gc_posts` VALUES (1,1,0,'Name','3GqYIJ3Obs','email@site.com','Subject','message body','message body','df740f13f6c59841743598b2fd9a45c9','162450778130.jpg','60056568.jpg','02a3317c1e16d88e052c1b6c5f181cd2',32174,750,751,199,200,'172.27.0.1','','2021-06-24 04:09:41',0,'0000-00-00 00:00:00','2021-06-24 04:09:41',0,0,0);
|
||||
INSERT INTO `gc_sections` VALUES (1,0,0,'Main','main');
|
||||
INSERT INTO `gc_staff` VALUES (1,'admin','$2a$04$L8aNP6T4IAENeg6YzEI/EOG4JbotSTtC7TC.2rQu/z6aFixOu7c52',3,'*','2021-06-24 04:06:37','2021-06-24 04:08:12');
|
||||
|
||||
GRANT ALL PRIVILEGES ON gochan_pre2021_db.* TO 'gochan'@'%';
|
||||
FLUSH PRIVILEGES;
|
57
vagrant/migrationtest/pre2021/pre2021-install.sh
Executable file
57
vagrant/migrationtest/pre2021/pre2021-install.sh
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
OLD_VERSION="2.12.0"
|
||||
OLD_GCDIR="gochan-v${OLD_VERSION}_linux"
|
||||
OLD_URL="https://github.com/gochan-org/gochan/releases/download/v$OLD_VERSION/$OLD_GCDIR.tar.gz"
|
||||
|
||||
if [ "$USER" = "root" ]; then
|
||||
echo "This testing script isn't intended to be run as root but will still probably run anyway."
|
||||
read -p "Press enter to continue anyway or ctrl+c to exit
|
||||
"
|
||||
fi
|
||||
|
||||
pgrep gochan > /dev/null
|
||||
if [ "$?" = "0" ]; then
|
||||
cat - <<- EOF
|
||||
A gochan instance is currently running. This script is intended for testing gochan migration,
|
||||
so only one instance should be running at a time
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "$1" ] || [ "$1" = "install" ]; then
|
||||
if [ -e ~/$OLD_GCDIR ]; then
|
||||
echo "Previous release is already installed, run $0 uninstall && $0"
|
||||
exit 1
|
||||
fi
|
||||
sudo mysql < /vagrant/vagrant/migrationtest/pre2021/gochan-${OLD_VERSION}-db.sql
|
||||
cd ~
|
||||
wget $OLD_URL
|
||||
tar -xvf "$OLD_GCDIR.tar.gz"
|
||||
rm "$OLD_GCDIR.tar.gz"
|
||||
cd $OLD_GCDIR
|
||||
cp sample-configs/gochan.example.json gochan.json
|
||||
|
||||
sed -i gochan.json \
|
||||
-e 's/"Port": 8080/"Port": 9000/' \
|
||||
-e 's/"UseFastCGI": false/"UseFastCGI": true/' \
|
||||
-e "s/\"DBtype\": .*/\"DBtype\": \"mysql\",/" \
|
||||
-e "s/\"DBname\": .*/\"DBname\": \"gochan_pre2021_db\",/" \
|
||||
-e 's/"DBpassword": ""/"DBpassword": "gochan"/' \
|
||||
-e 's/"Verbosity": 0/"Verbosity": 1/' \
|
||||
-e 's/"DebugMode": false/"DebugMode": true/'
|
||||
|
||||
mv gochan{,_$OLD_VERSION}
|
||||
mkdir -p html/test/{,res,src,thumb}
|
||||
echo ""
|
||||
echo "gochan v${OLD_VERSION} is ready to go. To start it, run"
|
||||
echo "screen -S gochan_$OLD_VERSION"
|
||||
echo "cd ~/$OLD_GCDIR"
|
||||
echo "./gochan_$OLD_VERSION"
|
||||
elif [ "$1" = "uninstall" ]; then
|
||||
sudo mysqladmin -f DROP gochan_pre2021_db
|
||||
killall "gochan_$OLD_VERSION"; rm -rf ~/$OLD_GCDIR
|
||||
else
|
||||
echo "Invalid argument. Usage is $1 [install|uninstall]"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue