moves the hosts from the java into resource files, could be improved upon, web stuff not done

This commit is contained in:
Timothy Prepscius 2013-08-19 14:50:08 -04:00
parent c9e5d551d8
commit 8078ebffaa
91 changed files with 162 additions and 28 deletions

2
deploy/config.hosts Normal file
View File

@ -0,0 +1,2 @@
M_HOST_PROD=`cat config/hosts/prod`
M_HOST_DEV=`cat config/hosts/dev`

4
deploy/config/hosts/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
dev
prod
*_dev
*_prod

14
deploy/config/hosts/make-dev Executable file
View File

@ -0,0 +1,14 @@
if [ -z "$1" ]; then echo "Must supply server name as argument"; exit 0; fi
dev=$1
echo $dev > primary_dev
echo $dev:8080 > tomcat_dev
echo $dev:8000 > web_dev
echo $dev > auth_dev
echo $dev > dev
echo "127.0.0.1" > local_db_dev
echo "127.0.0.1" > local_key_dev
echo "127.0.0.1" > local_mail_dev
echo "127.0.0.1" > local_smtp_dev

14
deploy/config/hosts/make-prod Executable file
View File

@ -0,0 +1,14 @@
if [ -z "$1" ]; then echo "Must supply server name (mailiverse.com) as argument"; exit 0; fi
prod=$1
echo $prod > prod
echo $prod > primary_prod
echo $prod > web_prod
echo mail.$prod > tomcat_prod
echo mail.$prod > auth_prod
echo mail.$prod > local_mail_prod
echo "127.0.0.1" > local_db_prod
echo "127.0.0.1" > local_key_prod
echo "127.0.0.1" > local_smtp_prod

View File

@ -1,2 +0,0 @@
M_HOST_PROD="your-prod"
M_HOST_DEV="ec2-54-234-177-43.compute-1.amazonaws.com"

View File

@ -0,0 +1 @@
../../../config/hosts/auth_dev

View File

@ -0,0 +1 @@
../../../config/hosts/auth_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_prod

View File

@ -0,0 +1 @@
../../../config/hosts/primary_dev

View File

@ -0,0 +1 @@
../../../config/hosts/primary_prod

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_dev

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_prod

View File

@ -0,0 +1 @@
../../../config/hosts/web_dev

View File

@ -0,0 +1 @@
../../../config/hosts/web_prod

View File

@ -0,0 +1 @@
../../../config/hosts/auth_dev

View File

@ -0,0 +1 @@
../../../config/hosts/auth_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_prod

View File

@ -0,0 +1 @@
../../../config/hosts/primary_dev

View File

@ -0,0 +1 @@
../../../config/hosts/primary_prod

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_dev

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_prod

View File

@ -0,0 +1 @@
../../../config/hosts/web_dev

View File

@ -0,0 +1 @@
../../../config/hosts/web_prod

View File

@ -0,0 +1 @@
../../../config/hosts/auth_dev

View File

@ -0,0 +1 @@
../../../config/hosts/auth_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_prod

View File

@ -0,0 +1 @@
../../../config/hosts/primary_dev

View File

@ -0,0 +1 @@
../../../config/hosts/primary_prod

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_dev

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_prod

View File

@ -0,0 +1 @@
../../../config/hosts/web_dev

View File

@ -0,0 +1 @@
../../../config/hosts/web_prod

View File

@ -0,0 +1 @@
../../../config/hosts/auth_dev

View File

@ -0,0 +1 @@
../../../config/hosts/auth_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_prod

View File

@ -0,0 +1 @@
../../../config/hosts/primary_dev

View File

@ -0,0 +1 @@
../../../config/hosts/primary_prod

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_dev

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_prod

View File

@ -0,0 +1 @@
../../../config/hosts/web_dev

View File

@ -0,0 +1 @@
../../../config/hosts/web_prod

View File

@ -0,0 +1 @@
../../../config/hosts/auth_dev

View File

@ -0,0 +1 @@
../../../config/hosts/auth_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_db_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_key_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_mail_prod

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_dev

View File

@ -0,0 +1 @@
../../../config/hosts/local_smtp_prod

View File

@ -0,0 +1 @@
../../../config/hosts/primary_dev

View File

@ -0,0 +1 @@
../../../config/hosts/primary_prod

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_dev

View File

@ -0,0 +1 @@
../../../config/hosts/tomcat_prod

View File

@ -0,0 +1 @@
../../../config/hosts/web_dev

View File

@ -0,0 +1 @@
../../../config/hosts/web_prod

1
install/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
setup-mysql.sql

View File

@ -1,6 +1,6 @@
CREATE DATABASE mail CHARACTER SET utf8;
CREATE DATABASE mail_extra CHARACTER SET utf8;
CREATE DATABASE captcha CHARACTER SET utf8;
CREATE DATABASE mail DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE DATABASE mail_extra DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE DATABASE captcha DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE DATABASE james CHARACTER SET utf8;
CREATE USER 'mail'@'localhost' IDENTIFIED BY 'MAIL_PASSWORD';
@ -8,7 +8,7 @@ CREATE USER 'mail_extra'@'localhost' IDENTIFIED BY 'MAIL_EXTRA_PASSWORD';
CREATE USER 'captcha'@'localhost' IDENTIFIED BY 'CAPTCHA_PASSWORD';
CREATE USER 'james'@'localhost' IDENTIFIED BY 'JAMES_PASSWORD';
GRANT ALL PRIVILEGES ON *.mail TO 'mail'@'localhost';
GRANT ALL PRIVILEGES ON *.mail_extra TO 'mail_extra'@'localhost';
GRANT ALL PRIVILEGES ON *.captcha TO 'captcha'@'localhost';
GRANT ALL PRIVILEGES ON *.james TO 'james'@'localhost';
GRANT ALL PRIVILEGES ON mail.* TO 'mail'@'localhost';
GRANT ALL PRIVILEGES ON mail_extra.* TO 'mail_extra'@'localhost';
GRANT ALL PRIVILEGES ON captcha.* TO 'captcha'@'localhost';
GRANT ALL PRIVILEGES ON james.* TO 'james'@'localhost';

View File

@ -1,5 +1,7 @@
package core.constants;
import core.util.Hosts;
public class ConstantsClientPlatform
{
public static final boolean DEBUG = false;
@ -10,17 +12,17 @@ public class ConstantsClientPlatform
{
if (DEBUG)
{
HOST = "mailiverse.com";
AUTH_HOST = "red";
TOMCAT_HOST = "YOUR_DEV_TOMCAT:8080";
WEB_HOST = "YOUR_DEV_WEB:8000";
HOST = Hosts.getHostFor("primary_dev");
AUTH_HOST = Hosts.getHostFor("auth_dev");
TOMCAT_HOST = Hosts.getHostFor("tomcat_dev");
WEB_HOST = Hosts.getHostFor("web_dev");
}
else
{
HOST = "mailiverse.com";
AUTH_HOST = "mail.mailiverse.com";
TOMCAT_HOST = "mail.mailiverse.com";
WEB_HOST = "www.mailiverse.com";
HOST = Hosts.getHostFor("primary_prod");
AUTH_HOST = Hosts.getHostFor("auth_prod");
TOMCAT_HOST = Hosts.getHostFor("tomcat_prod");
WEB_HOST = Hosts.getHostFor("web_prod");
}
}
}

View File

@ -1,11 +1,14 @@
package core.constants;
import core.util.Hosts;
public class ConstantsServer
{
public static final boolean DEBUG = System.getenv("PRODUCTION")==null;
public static final String LOCAL_MAIL_SERVER, DBCONNECTION_PREFIX;
public static final String KEY_SERVER;
public static final String LOCAL_SMTP_HOST;
static
{
@ -13,26 +16,27 @@ public class ConstantsServer
{
System.out.println("Running DEBUG Mode");
LOCAL_MAIL_SERVER = "red";
DBCONNECTION_PREFIX = "jdbc:mysql://red/";
KEY_SERVER = "red";
LOCAL_MAIL_SERVER = Hosts.getHostFor("local_mail_dev");
DBCONNECTION_PREFIX = "jdbc:mysql://" + Hosts.getHostFor("local_db_dev") + "/";
KEY_SERVER = Hosts.getHostFor("local_key_dev");
LOCAL_SMTP_HOST = Hosts.getHostFor("local_smtp_dev");
}
else
{
System.out.println("Running PRODUCTION Mode");
KEY_SERVER = "localhost";
KEY_SERVER = Hosts.getHostFor("local_key_prod");
// the mail server has to be the full name, or else the SSL certificate fails
LOCAL_MAIL_SERVER = "mail.mailiverse.com";
DBCONNECTION_PREFIX = "jdbc:mysql://localhost/";
LOCAL_MAIL_SERVER = Hosts.getHostFor("local_mail_prod");
DBCONNECTION_PREFIX = "jdbc:mysql://" + Hosts.getHostFor("local_db_prod") + "/";
LOCAL_SMTP_HOST = Hosts.getHostFor("local_smtp_prod");
}
}
public static final String SMTP_HOST = LOCAL_MAIL_SERVER;
public static final int SMTP_PORT = 25;
public static final String LOCAL_SMTP_HOST = "YOUR_LOCAL_SMTP_HOST";
public static final String LOCAL_SMTP_PORT = "10025";
public static final String KEY_AUTH_HOST = KEY_SERVER;

View File

@ -0,0 +1,17 @@
package core.util;
public class Hosts
{
public static String getHostFor (String key)
{
try
{
return ExternalResource.getTrimmedString("hosts/" + key);
}
catch (Exception e)
{
throw new RuntimeException("Internal error. #9204 " + key);
}
}
}

View File

@ -25,15 +25,13 @@ public class ProxySelectorRegex extends ProxySelector
"localhost",
"127\\.0.*",
"192\\.168\\.1\\..*",
".*piratemail\\.se",
"blue",
".*mailiverse\\.com",
".*\\.dropbox\\.com",
"s3\\.amazonaws\\.com",
"s3\\.amazonaws\\.com\\.",
".*\\.s3\\.amazonaws\\.com",
".*\\.s3\\.amazonaws\\.com\\.",
".*\\.push\\.apple\\.com"
".*\\.push\\.apple\\.com",
".*" + (Hosts.getHostFor("primary_prod").replace(".", "\\."))
} ;
List<Proxy> NoProxy = Arrays.asList(new Proxy[] { Proxy.NO_PROXY });