New domain options and properties for Debian Bookworm #1

Closed
hsh-timotheuspokorra wants to merge 41 commits from TP-202311-vhost-bookworm into rel_4.0
6 changed files with 176 additions and 2 deletions
Showing only changes of commit 513431584e - Show all commits

View File

@ -88,3 +88,10 @@ INSERT INTO domain_option (domain_option_name) VALUES ('passenger');
INSERT INTO domain_option (domain_option_name) VALUES ('passengerfriendlyerrorpages'); INSERT INTO domain_option (domain_option_name) VALUES ('passengerfriendlyerrorpages');
INSERT INTO domain_option (domain_option_name) VALUES ('cgi'); INSERT INTO domain_option (domain_option_name) VALUES ('cgi');
INSERT INTO domain_option (domain_option_name) VALUES ('fastcgi'); INSERT INTO domain_option (domain_option_name) VALUES ('fastcgi');
ALTER TABLE domain ADD COLUMN passenger_python character varying(255);
ALTER TABLE domain ADD COLUMN passenger_nodejs character varying(255);
ALTER TABLE domain ADD COLUMN passenger_ruby character varying(255);
ALTER TABLE domain ADD COLUMN fcgi_php_bin character varying(255);
ALTER TABLE domain ADD COLUMN proxy_http_port integer;
ALTER TABLE domain ADD COLUMN proxy_websocket_port integer;

View File

@ -319,7 +319,13 @@ CREATE TABLE domain (
domain_dns_master character varying(64), domain_dns_master character varying(64),
domain_id integer DEFAULT nextval('domain_domain_id_seq'::regclass) NOT NULL, domain_id integer DEFAULT nextval('domain_domain_id_seq'::regclass) NOT NULL,
domain_owner integer NOT NULL, domain_owner integer NOT NULL,
valid_subdomain_names character varying(256) DEFAULT 'www' NOT NULL valid_subdomain_names character varying(256) DEFAULT 'www' NOT NULL,
passenger_python character varying(256) NULL,
passenger_nodejs character varying(256) NULL,
passenger_ruby character varying(256) NULL,
fcgi_php_bin character varying(256) NULL,
proxy_http_port integer DEFAULT NULL,
proxy_websocket_port integer DEFAULT NULL
); );

View File

@ -51,6 +51,18 @@ public class DomainRemote extends AbstractRemote {
} }
final String validsubdomains = dom.getValidsubdomainnames(); final String validsubdomains = dom.getValidsubdomainnames();
resultMap.put("validsubdomainnames", validsubdomains); resultMap.put("validsubdomainnames", validsubdomains);
final String passengerpython = dom.getPassengerPython();
resultMap.put("passengerpython", passengerpython);
final String passengernodejs = dom.getPassengerNodejs();
resultMap.put("passengernodejs", passengernodejs);
final String passengerruby = dom.getPassengerRuby();
resultMap.put("passengerruby", passengerruby);
final String passengerfcgiphpbin = dom.getPassengerFcgiPhpBin();
resultMap.put("passengerfcgiphpbin", passengerfcgiphpbin);
final String proxyhttpport = dom.getProxyHttpPort();
resultMap.put("proxyhttpport", proxyhttpport);
final String proxywebsocketport = dom.getProxyWebsocketPort();
resultMap.put("proxywebsocketport", proxywebsocketport);
} }
@Override @Override
@ -92,6 +104,30 @@ public class DomainRemote extends AbstractRemote {
if (validsubdomains != null && validsubdomains instanceof String) { if (validsubdomains != null && validsubdomains instanceof String) {
dom.setValidsubdomainnames((String) validsubdomains); dom.setValidsubdomainnames((String) validsubdomains);
} }
final Object passengerpython = setParams.get("passengerpython");
if (passengerpython != null && passengerpython instanceof String) {
dom.setPassengerPython((String) passengerpython);
}
final Object passengernodejs = setParams.get("passengernodejs");
if (passengernodejs != null && passengernodejs instanceof String) {
dom.setPassengerNodejs((String) passengernodejs);
}
final Object passengerruby = setParams.get("passengerruby");
if (passengerruby != null && passengerruby instanceof String) {
dom.setPassengerRuby((String) passengerruby);
}
final Object fcgiphpbin = setParams.get("fcgiphpbin");
if (fcgiphpbin != null && fcgiphpbin instanceof String) {
dom.setFcgiPhpBin((String) fcgiphpbin);
}
final Object proxyhttpport = setParams.get("proxyhttpport");
if (proxyhttpport != null && proxyhttpport instanceof Integer) {
dom.setProxyHttpPort((Integer)proxyhttpport);
}
final Object proxywebsocketport = setParams.get("proxywebsocketport");
if (proxywebsocketport != null && proxywebsocketport instanceof Integer) {
dom.setProxyWebsocketPort((Integer)proxywebsocketport);
}
} }
@Override @Override

View File

@ -121,6 +121,12 @@ public class JsonPillarServlet extends HttpServlet {
domainadmins.add(domUserName); domainadmins.add(domUserName);
final Pac domPac = domUser.getPac(); final Pac domPac = domUser.getPac();
final String validSubdomainNames = dom.getValidsubdomainnames(); final String validSubdomainNames = dom.getValidsubdomainnames();
final String passengerPython = dom.getPassengerPython();
final String passengerNodejs = dom.getPassengerNodejs();
final String passengerRuby = dom.getPassengerRuby();
final String fcgiPhpBin = dom.getFcgiPhpBin();
final Integer proxyHttpPort = dom.getProxyHttpPort();
final Integer proxyWebsocketPort = dom.getProxyWebsocketPort();
final INetAddress domINetAddr = domPac.getCurINetAddr(); final INetAddress domINetAddr = domPac.getCurINetAddr();
writer.println(" \"domain\": \"" + domName + "\""); writer.println(" \"domain\": \"" + domName + "\"");
writer.println(" , \"pac\": \"" + domPac.getName() + "\""); writer.println(" , \"pac\": \"" + domPac.getName() + "\"");
@ -148,6 +154,24 @@ public class JsonPillarServlet extends HttpServlet {
} }
writer.println(" }"); writer.println(" }");
writer.println(" , \"validsubdomains\": \"" + validSubdomainNames + "\""); writer.println(" , \"validsubdomains\": \"" + validSubdomainNames + "\"");
if (passengerPython.length() > 0) {
writer.println(" , \"passengerpython\": \"" + passengerPython + "\"");
}
if (passengerNodejs.length() > 0) {
writer.println(" , \"passengernodejs\": \"" + passengerNodejs + "\"");
}
if (passengerRuby.length() > 0) {
writer.println(" , \"passengerruby\": \"" + passengerRuby + "\"");
}
if (fcgPhpBin.length() > 0) {
writer.println(" , \"fcgiphpbin\": \"" + fcgPhpBin + "\"");
}
if (proxyHttpPort > 0) {
writer.println(" , \"proxyhttpport\": \"" + proxyHttpPort.toString() + "\"");
}
if (proxyWebsocketPort > 0) {
writer.println(" , \"proxywebsocketport\": \"" + proxyWebsocketPort.toString() + "\"");
}
writer.println(" }"); writer.println(" }");
} }
writer.println(" ]"); writer.println(" ]");

View File

@ -122,6 +122,15 @@
#end #end
#if( ${passengerfriendlyerrorpages} ) #if( ${passengerfriendlyerrorpages} )
PassengerFriendlyErrorPages On PassengerFriendlyErrorPages On
#end
#if( ${passengerpython} )
PassengerPython /home/pacs/${pac.name}/users/${dom.user.name}/${passengerpython}
#end
#if( ${passengernodejs} )
PassengerNodejs /home/pacs/${pac.name}/users/${dom.user.name}/${passengernodejs}
#end
#if( ${passengerruby} )
PassengerRuby /home/pacs/${pac.name}/users/${dom.user.name}/${passengerruby}
#end #end
AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,IncludesNoExec,Indexes,MultiViews,SymLinksIfOwnerMatch,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,IncludesNoExec,Indexes,MultiViews,SymLinksIfOwnerMatch,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
</Directory> </Directory>
@ -170,6 +179,26 @@
RewriteCond /home/doms/${dom.name}/subs-ssl/#[[${tolower:%1} ]]# !-d RewriteCond /home/doms/${dom.name}/subs-ssl/#[[${tolower:%1} ]]# !-d
RewriteRule ^(.*) - [redirect=404,last] RewriteRule ^(.*) - [redirect=404,last]
#end
#if( ${proxywebsocketport} )
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP:Connection} Upgrade [NC,OR]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule .* ws://127.0.0.1:${proxywebsocketport}/%{REQUEST_URI} [proxy]
#end
#if( ${proxyhttpport} )
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:${proxyhttpport}/%{REQUEST_URI} [proxy,last]
RequestHeader set X-Forwarded-Proto "https"
#end
#if( ${fcgiphpbin} )
SetEnv HTTP_PHP_BIN ${fcgiphpbin}
#end #end
AddType application/x-httpd-php .php .php5 .php4 .php3 AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub Action application/x-httpd-php /fastcgi-bin/phpstub

View File

@ -65,7 +65,31 @@ public class Domain extends AbstractEntity {
@AnnFieldIO(validation="([a-z0-9\\-]+\\,)*[a-z0-9\\-]+|\\*|", rw=ReadWriteAccess.READWRITE) @AnnFieldIO(validation="([a-z0-9\\-]+\\,)*[a-z0-9\\-]+|\\*|", rw=ReadWriteAccess.READWRITE)
@Column(name = "valid_subdomain_names", columnDefinition = "character varying(512)") @Column(name = "valid_subdomain_names", columnDefinition = "character varying(512)")
private String validsubdomainnames; private String validsubdomainnames;
@AnnFieldIO(validation="[a-zA-Z0-9\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
@Column(name = "passenger_python", columnDefinition = "character varying(256)")
private String passengerpython;
@AnnFieldIO(validation="[a-zA-Z0-9\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
@Column(name = "passenger_nodejs", columnDefinition = "character varying(256)")
private String passengernodejs;
@AnnFieldIO(validation="[a-zA-Z0-9\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
@Column(name = "passenger_ruby", columnDefinition = "character varying(256)")
private String passengerruby;
@AnnFieldIO(validation="[a-zA-Z0-9\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
@Column(name = "fcgi_php_bin", columnDefinition = "character varying(256)")
private String fcgiphpbin;
@AnnFieldIO(validation="[0-9]*", rw=ReadWriteAccess.READWRITE)
@Column(name = "proxy_http_port", columnDefinition = "integer")
private Integer proxyhttpport;
@AnnFieldIO(validation="[0-9]*", rw=ReadWriteAccess.READWRITE)
@Column(name = "proxy_websocket_port", columnDefinition = "integer")
private Integer proxywebsocketport;
public Domain() { public Domain() {
} }
@ -191,6 +215,54 @@ public class Domain extends AbstractEntity {
this.validsubdomainnames = validSubdomainNames; this.validsubdomainnames = validSubdomainNames;
} }
public String getPassengerPython() {
return passengerpython;
}
public void setPassengerPython(String value) {
passengerpython = value;
}
public String getPassengerNodejs() {
return passengernodejs;
}
public void setPassengerNodejs(String value) {
passengernodejs = value;
}
public String getPassengerRuby() {
return passengerruby;
}
public void setPassengerRuby(String value) {
passengerruby = value;
}
public String getFcgiPhpBin() {
return fcgiphpbin;
}
public void setFcgiPhpBin(String value) {
fcgiphpbin = value;
}
public Integer getProxyHttpPort() {
return proxyhttpport;
}
public void setProxyHttpPort(String value) {
proxyhttpport = value;
}
public Integer getProxyWebsocketPort() {
return proxywebsocketport;
}
public void setProxyWebsocketPort(String value) {
proxywebsocketport = value;
}
public String getServeraliases() { public String getServeraliases() {
String[] subs = validsubdomainnames.split(","); String[] subs = validsubdomainnames.split(",");
StringBuffer aliases = new StringBuffer(); StringBuffer aliases = new StringBuffer();