Hey guys,
I found it a bit cumbersome copying and editing the wfmigrate scripts for each app, so I created a script that copies the necessary account info into each template to get started.
Copy the following script to ~/bin/wfmigrate_templates
and chmod +X ~/bin/wfmigrate_templates
. Then run it, and it will automatically create all the necessary templates for migration, pre-populated with your server info.
I hope it's useful for others!
#!/bin/bash
CONFIGS="wordpress generic_php generic_maria generic_php generic_psql generic_port"
TEMPLATE_PATH=$HOME/configs/templates
mkdir -p $TEMPLATE_PATH
cd $TEMPLATE_PATH
for conf in $CONFIGS
do
cp /opt/app_migrators/wf_$conf/config-template.ini $conf.ini
done
echo "**Enter Opalstack Information**"
echo -n "Username: "
read opal_user
echo -n "API Token: "
read opal_api
echo -n "Opalstack Server (e.g. opal1.opalstacked.com): "
read opal_server
echo -n "Opalstack IP (e.g. 1.2.3.4): "
read opal_ip
echo "**Enter Webfaction Information**"
echo -n "Username: "
read wf_user
echo -n "Account Password: "
read wf_pass
echo -n "SSH Password: "
read wf_ssh_pass
echo -n "WF Server (e.g. web450): "
read wf_server
cat <<EOF > accounts
[opalstack]
account = $opal_user
apitoken = $opal_api
web_server = $opal_server
ip = $opal_ip
[webfaction]
account = $wf_user
account_pass = $wf_pass
ssh_pass = $wf_ssh_pass
server = $wf_server
EOF
# replace existing templates
sed -i "1,11d" *.ini
for f in $(ls *.ini)
do
cat accounts $f > temp && mv temp $f
done