Commit f77c44ba authored by Philip Schildkamp's avatar Philip Schildkamp

Fix tee appendage, finalize MCD

parent 14be7d86
......@@ -12,15 +12,18 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
sudo tee "$CONFIGURE_CONFDIR/local.d/10-bindings.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/15-bindings.ini" \
<<< "[httpd]"$'\n'"bind_address = 0.0.0.0"$'\n'"port = $DBMSPort"
sudo tee -a "$CONFIGURE_CONFDIR/local.d/20-cors.ini" \
<<< "[httpd]"$'\n'"enable_cors = true"$'\n'"[cors]"$'\n'"origins = *"
sudo mkdir "/run/$CONFIGURE_PACKAGE"
sudo chown couchdb:couchdb "/run/$CONFIGURE_PACKAGE"
sudo chown couchdb:couchdb "$CONFIGURE_CONFDIR/local.d/"*
sudo chown "$CONFIGURE_PACKAGE":"$CONFIGURE_PACKAGE" \
"/run/$CONFIGURE_PACKAGE" "$CONFIGURE_CONFDIR/local.d/"*
}
# env
......
......@@ -12,15 +12,18 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
sudo tee "$CONFIGURE_CONFDIR/local.d/10-bindings.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/15-bindings.ini" \
<<< "[httpd]"$'\n'"bind_address = 0.0.0.0"$'\n'"port = $DBMSPort"
sudo tee -a "$CONFIGURE_CONFDIR/local.d/20-cors.ini" \
<<< "[httpd]"$'\n'"enable_cors = true"$'\n'"[cors]"$'\n'"origins = *"
sudo mkdir "/run/$CONFIGURE_PACKAGE"
sudo chown couchdb:couchdb "/run/$CONFIGURE_PACKAGE"
sudo chown couchdb:couchdb "$CONFIGURE_CONFDIR/local.d/"*
sudo chown "$CONFIGURE_PACKAGE":"$CONFIGURE_PACKAGE" \
"/run/$CONFIGURE_PACKAGE" "$CONFIGURE_CONFDIR/local.d/"*
}
# env
......
......@@ -12,11 +12,18 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
sudo tee "$CONFIGURE_CONFDIR/local.d/10-bindings.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-bindings.ini" \
<<< "[chttpd]"$'\n'"bind_address = 0.0.0.0"$'\n'"port = $DBMSPort"
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-cors.ini" \
<<< "[chttpd]"$'\n'"enable_cors = true"$'\n'"[cors]"$'\n'"origins = *"
sudo mkdir "/run/$CONFIGURE_PACKAGE"
sudo chown "$CONFIGURE_PACKAGE":"$CONFIGURE_PACKAGE" \
"/run/$CONFIGURE_PACKAGE" "$CONFIGURE_CONFDIR/local.d/"*
}
# env
......
......@@ -12,11 +12,18 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-admins.ini" \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
sudo tee "$CONFIGURE_CONFDIR/local.d/10-bindings.ini" \
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-bindings.ini" \
<<< "[chttpd]"$'\n'"bind_address = 0.0.0.0"$'\n'"port = $DBMSPort"
sudo tee -a "$CONFIGURE_CONFDIR/local.d/10-cors.ini" \
<<< "[chttpd]"$'\n'"enable_cors = true"$'\n'"[cors]"$'\n'"origins = *"
sudo mkdir "/run/$CONFIGURE_PACKAGE"
sudo chown "$CONFIGURE_PACKAGE":"$CONFIGURE_PACKAGE" \
"/run/$CONFIGURE_PACKAGE" "$CONFIGURE_CONFDIR/local.d/"*
}
# env
......
......@@ -23,7 +23,7 @@ fn_pkgrepo() {
curl -s "$INSTALL_REPOKEY" | sudo apt-key add -
sudo tee "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
sudo tee -a "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
<<< "deb $INSTALL_REPOURL $DISTRIB_CODENAME main"
sudo apt-get -qy update
......
......@@ -23,7 +23,7 @@ fn_pkgrepo() {
curl -s "$INSTALL_REPOKEY" | sudo apt-key add -
sudo tee "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
sudo tee -a "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
<<< "deb $INSTALL_REPOURL $DISTRIB_CODENAME main"
sudo apt-get -qy update
......
......@@ -12,8 +12,17 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" <<< "http.port: $APIPort"
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" <<< "network.host: 0.0.0.0"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.allow-origin: '*'"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.enabled: true"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.port: $APIPort"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "network.host: 0.0.0.0"
}
# env
......
......@@ -12,8 +12,17 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" <<< "http.port: $APIPort"
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" <<< "network.host: 0.0.0.0"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.allow-origin: '*'"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.enabled: true"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.port: $APIPort"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "network.host: 0.0.0.0"
}
# env
......
......@@ -12,13 +12,19 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" \
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.allow-origin: '*'"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.enabled: true"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "discovery.type: single-node"
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" \
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.port: $APIPort"
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" \
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "network.host: 0.0.0.0"
}
......
......@@ -12,13 +12,19 @@ fn_pkginfo() {
fn_configure() {
test -d "$CONFIGURE_CONFDIR" || return 1
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" \
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.allow-origin: '*'"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.cors.enabled: true"
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "discovery.type: single-node"
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" \
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "http.port: $APIPort"
sudo tee "$CONFIGURE_CONFDIR/elasticsearch.yml" \
sudo tee -a "$CONFIGURE_CONFDIR/elasticsearch.yml" \
<<< "network.host: 0.0.0.0"
}
......
......@@ -22,7 +22,7 @@ fn_pkgrepo() {
curl -s "$INSTALL_REPOKEY" | sudo apt-key add -
sudo tee "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
sudo tee -a "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
<<< "deb $INSTALL_REPOURL stable main"
sudo apt-get -qy update
......
......@@ -22,7 +22,7 @@ fn_pkgrepo() {
curl -s "$INSTALL_REPOKEY" | sudo apt-key add -
sudo tee "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
sudo tee -a "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
<<< "deb $INSTALL_REPOURL stable main"
sudo apt-get -qy update
......
......@@ -5,14 +5,12 @@ fn_pkginfo() {
CONNECT_PACKAGE="musical-competitions"
CONNECT_VERSION="0.0.1"
# ----------------------------------------------------------------------------
INSTALL_APIHOST="http://$VMIP:$APIPort"
INSTALL_DBMSAPI="http://$DBMSUser:$DBMSPassword@$VMIP:$DBMSPort"
INSTALL_EXECDIR="/opt/$INSTALL_PACKAGE/$INSTALL_VERSION"
CONNECT_EXECDIR="/opt/$CONNECT_PACKAGE/$CONNECT_VERSION"
}
# connect
fn_connect() {
exec >> "$INSTALL_EXECDIR/$ChannelType.env"
exec > >(sudo tee -a "$CONNECT_EXECDIR/$ChannelType.env")
case "$ChannelType" in
"CouchDB")
......@@ -20,15 +18,11 @@ fn_connect() {
echo "DBMSPort=$DBMSPort"
echo "DBUser=$DBUser"
echo "DBPassword=$DBPassword"
sed -i "s/\(\"couchdb\":\).*/\1 \"$INSTALL_DBMSAPI\"/" \
"$INSTALL_EXECDIR/package.json"
;;
"Elasticsearch")
echo "VMIP=$VMIP"
echo "APIPort=$APIPort"
echo "IndexName=$IndexName"
sed -i "s/\(\"elasticsearch\":\).*/\1 \"$INSTALL_APIHOST\"/" \
"$INSTALL_EXECDIR/package.json"
;;
esac
}
......
......@@ -5,14 +5,12 @@ fn_pkginfo() {
CONNECT_PACKAGE="musical-competitions"
CONNECT_VERSION="0.0.1"
# ----------------------------------------------------------------------------
INSTALL_APIHOST="http://$VMIP:$APIPort"
INSTALL_DBMSAPI="http://$DBMSUser:$DBMSPassword@$VMIP:$DBMSPort"
INSTALL_EXECDIR="/opt/$INSTALL_PACKAGE/$INSTALL_VERSION"
CONNECT_EXECDIR="/opt/$CONNECT_PACKAGE/$CONNECT_VERSION"
}
# connect
fn_connect() {
exec >> "$INSTALL_EXECDIR/$ChannelType.env"
exec > >(sudo tee -a "$CONNECT_EXECDIR/$ChannelType.env")
case "$ChannelType" in
"CouchDB")
......@@ -20,15 +18,11 @@ fn_connect() {
echo "DBMSPort=$DBMSPort"
echo "DBUser=$DBUser"
echo "DBPassword=$DBPassword"
sed -i "s/\(\"couchdb\":\).*/\1 \"$INSTALL_DBMSAPI\"/" \
"$INSTALL_EXECDIR/package.json"
;;
"Elasticsearch")
echo "VMIP=$VMIP"
echo "APIPort=$APIPort"
echo "IndexName=$IndexName"
sed -i "s/\(\"elasticsearch\":\).*/\1 \"$INSTALL_APIHOST\"/" \
"$INSTALL_EXECDIR/package.json"
;;
esac
}
......
......@@ -6,7 +6,7 @@ fn_pkginfo() {
INSTALL_VERSION="0.0.1"
# ----------------------------------------------------------------------------
INSTALL_EXECDIR="/opt/$INSTALL_PACKAGE/$INSTALL_VERSION"
INSTALL_GITREPO="https://github.com/amarcic/PreisausschreibenApp"
INSTALL_GITREPO="https://github.com/schlusslicht/PreisausschreibenApp"
}
# install
......@@ -25,5 +25,5 @@ source /etc/lsb-release
sudo apt-get -qy update
# flow
fn_pkginfo && fn_pkgrepo && fn_install \
fn_pkginfo && fn_install \
|| echo "ERROR=INSTALL:$INSTALL_PACKAGE"
......@@ -6,7 +6,7 @@ fn_pkginfo() {
INSTALL_VERSION="0.0.1"
# ----------------------------------------------------------------------------
INSTALL_EXECDIR="/opt/$INSTALL_PACKAGE/$INSTALL_VERSION"
INSTALL_GITREPO="https://github.com/amarcic/PreisausschreibenApp"
INSTALL_GITREPO="https://github.com/schlusslicht/PreisausschreibenApp"
}
# install
......@@ -25,5 +25,5 @@ source /etc/lsb-release
sudo apt-get -qy update
# flow
fn_pkginfo && fn_pkgrepo && fn_install \
fn_pkginfo && fn_install \
|| echo "ERROR=INSTALL:$INSTALL_PACKAGE"
......@@ -14,10 +14,14 @@ fn_start() {
test -f "$START_EXECDIR/Elasticsearch.env" || return 1
source "$START_EXECDIR/CouchDB.env"
export COUCH="http://$DBMSUser:$DBMSPassword@$VMIP:$DBMSPort"
export COUCH="http://$VMIP:$DBMSPort"
sudo sed -i "s#\(\"couchdb\":\) \"http.*#\1 \"$COUCH/\",#" \
"$START_EXECDIR/package.json"
source "$START_EXECDIR/Elasticsearch.env"
export ELASTIC="http://$VMIP:$APIPort"
sudo sed -i "s#\(\"elasticsearch\":\) \"http.*#\1 \"$ELASTIC/\",#" \
"$START_EXECDIR/package.json"
(cd "$START_EXECDIR/utils" && sudo ./syncCouchElastic.sh)
(cd "$START_EXECDIR" && sudo npm run build)
......
......@@ -14,10 +14,14 @@ fn_start() {
test -f "$START_EXECDIR/Elasticsearch.env" || return 1
source "$START_EXECDIR/CouchDB.env"
export COUCH="http://$DBMSUser:$DBMSPassword@$VMIP:$DBMSPort"
export COUCH="http://$VMIP:$DBMSPort"
sudo sed -i "s#\(\"couchdb\":\) \"http.*#\1 \"$COUCH/\",#" \
"$START_EXECDIR/package.json"
source "$START_EXECDIR/Elasticsearch.env"
export ELASTIC="http://$VMIP:$APIPort"
sudo sed -i "s#\(\"elasticsearch\":\) \"http.*#\1 \"$ELASTIC/\",#" \
"$START_EXECDIR/package.json"
(cd "$START_EXECDIR/utils" && sudo ./syncCouchElastic.sh)
(cd "$START_EXECDIR" && sudo npm run build)
......
user www-data;
pid /run/nginx.pid;
worker_processes auto;
error_log /proc/1/fd/1 warn;
pcre_jit on;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
......@@ -25,19 +9,16 @@ http {
proxy_max_temp_file_size 0;
client_max_body_size 0;
server {
listen 80 default_server;
root /opt/musical-competitions/0.0.1/dist;
listen 80 default_server;
root /opt/musical-competitions/0.0.1/dist;
location / {
return 307 /app;
}
location /app {
try_files $uri $uri/ /index.html$is_args$args;
}
location /assets {
try_files $uri =404;
}
location = / {
return 307 ./app;
}
location /app {
try_files $uri $uri/ /index.html$is_args$args;
}
location /assets {
alias /opt/musical-competitions/0.0.1/dist;
}
}
......@@ -16,7 +16,7 @@ fn_configure() {
while read -rd ';' TUPLE; do FILE="${TUPLE#*,}"
test "${FILE%.$CONFIGURE_PACKAGE}" == "$FILE" && continue
sudo cp "$CONFIGURE_CSARDIR/$FILE" "$CONFIGURE_CONFDIR"
sudo mv "$CONFIGURE_CSARDIR/$FILE" "$CONFIGURE_CONFDIR"
done <<< "$DAs"
}
......
......@@ -16,7 +16,7 @@ fn_configure() {
while read -rd ';' TUPLE; do FILE="${TUPLE#*,}"
test "${FILE%.$CONFIGURE_PACKAGE}" == "$FILE" && continue
sudo cp "$CONFIGURE_CSARDIR/$FILE" "$CONFIGURE_CONFDIR"
sudo mv "$CONFIGURE_CSARDIR/$FILE" "$CONFIGURE_CONFDIR"
done <<< "$DAs"
}
......
......@@ -22,7 +22,7 @@ fn_pkgrepo() {
curl -s "$INSTALL_REPOKEY" | sudo apt-key add -
sudo tee "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
sudo tee -a "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
<<< "deb $INSTALL_REPOURL $DISTRIB_CODENAME main"
sudo apt-get -qy update
......
......@@ -22,7 +22,7 @@ fn_pkgrepo() {
curl -s "$INSTALL_REPOKEY" | sudo apt-key add -
sudo tee "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
sudo tee -a "/etc/apt/sources.list.d/$INSTALL_PACKAGE.list" \
<<< "deb $INSTALL_REPOURL $DISTRIB_CODENAME main"
sudo apt-get -qy update
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment