comment out some stuff
This commit is contained in:
208
commands/bx-webpage/bx-webpage-setup.sh
Normal file
208
commands/bx-webpage/bx-webpage-setup.sh
Normal file
@ -0,0 +1,208 @@
|
||||
#!/bin/bash
|
||||
# Example Usage
|
||||
# ssh user@host "sudo -n bash -s" -- < ./commands/bx-webpage/bx-webpage-setup.sh
|
||||
|
||||
# TODO: allow for input to setup domains
|
||||
|
||||
if [ "$1" == "-h" ]; then
|
||||
echo "Usage:"
|
||||
echo " ./bx-webpage-setup.sh"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# setup node LTS
|
||||
# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||
# export NVM_DIR="$HOME/.nvm"
|
||||
# [ -s"$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
# [ -s"$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
# nvm install --lts
|
||||
|
||||
# Install node for all users
|
||||
# https://computingforgeeks.com/installing-node-js-10-lts-on-ubuntu-18-04-16-04-debian-9/
|
||||
# curl -sL https://deb.nodesource.com/setup_12.x | bash
|
||||
# apt install -y nodejs
|
||||
|
||||
# Setup website
|
||||
# mkdir /bergx
|
||||
# mkdir /bergx/bx-webpage
|
||||
# mkdir /bergx/bx-webpage/dist
|
||||
# touch /bergx/bx-webpage/dist/index.html
|
||||
|
||||
# Setup console
|
||||
# mkdir /bergx/bx-webpage
|
||||
# mkdir /bergx/bx-console/dist
|
||||
# touch /bergx/bx-console/dist/index.html
|
||||
|
||||
# Setup service
|
||||
# mkdir /bergx/bx-service
|
||||
# mkdir /bergx/bx-service/build
|
||||
# mkdir /bergx/bx-service/build/bin/
|
||||
# touch /bergx/bx-service/build/bin/www.js
|
||||
|
||||
# cat > /bergx/bx-webpage/dist/index.html << EndOfIndex
|
||||
# <html>
|
||||
# <body>
|
||||
# Yo
|
||||
# </body>
|
||||
# </html>
|
||||
# EndOfIndex
|
||||
|
||||
# Config can be found in bx-webpage.conf
|
||||
cat > /etc/nginx/conf.d/bx-webpage.conf << EndOfConfig
|
||||
server {
|
||||
listen 80;
|
||||
server_name www.bergx.io;
|
||||
return 301 https://\$server_name\$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name p01.bergx.io;
|
||||
return 301 https://\$server_name\$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name bergx.io;
|
||||
return 301 https://\$server_name\$request_uri;
|
||||
}
|
||||
|
||||
upstream bergx-api {
|
||||
server localhost:3030;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name ^p01.bergx.io;
|
||||
keepalive_timeout 70;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/p01.bergx.io/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/p01.bergx.io/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
|
||||
location / {
|
||||
root /bergx/bx-console;
|
||||
try_files \$uri /index.html;
|
||||
}
|
||||
|
||||
location ~^/(api|auth|public|oauth) {
|
||||
proxy_pass http://bergx-api;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host \$host;
|
||||
proxy_cache_bypass \$http_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name bergx.io ~^(www.)?bergx.io;
|
||||
keepalive_timeout 70;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/p01.bergx.io/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/p01.bergx.io/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
|
||||
location / {
|
||||
root /bergx/bx-webpage;
|
||||
try_files \$uri /index.html;
|
||||
}
|
||||
}
|
||||
EndOfConfig
|
||||
|
||||
# cat > /etc/systemd/system/bergx.service << EndOfFile
|
||||
# [Unit]
|
||||
# Description=Bergx server
|
||||
# After=mysql.service
|
||||
#
|
||||
# [Service]
|
||||
# WorkingDirectory=/bergx/bx-service
|
||||
# ExecStart=/usr/bin/node /bergx/bx-service/build/bin/www.js
|
||||
# Restart=always
|
||||
# # Restart service after 10 seconds if node service crashes
|
||||
# RestartSec=10
|
||||
# # Output to syslog
|
||||
# StandardOutput=syslog
|
||||
# # Output to syslog
|
||||
# StandardError=syslog
|
||||
# SyslogIdentifier=bergx-server
|
||||
# # User=nginx
|
||||
# # Group=nginx
|
||||
# Environment=NODE_ENV=production PORT=3030
|
||||
#
|
||||
# [Install]
|
||||
# WantedBy=multi-user.target
|
||||
# EndOfFile
|
||||
|
||||
# cat > /bergx/bx-service/.env << EndOfEnv
|
||||
# DEBUG=am-feature-switches:*
|
||||
#
|
||||
# ENVIRONMENT_NAME=gc-p01
|
||||
#
|
||||
# ADMIN_ACCOUNTS=mason.payne@bergx.io
|
||||
# # ADMIN_ACCOUNTS=
|
||||
#
|
||||
# SESSION_SECRET=ZxsgDIUIF2eShEmK0CkAwE0aBGHQ5olV7HfeRV8QEfvV40QwoMkObpJdSAaQGtsr
|
||||
# JWT_SECRET=7srhHUVuQYX4O8JlCKqCRcWgOKB2w5bcWwO7zUv74dolGh0WCsuDbj5cgjMN9ivY
|
||||
# JWT_EXPIRATION=30m
|
||||
# ACCESS_TOKEN_EXPIRATION=30m
|
||||
#
|
||||
# CURRENT_HOST=https://p01.bergx.io
|
||||
# SEND_EMAILS=true
|
||||
#
|
||||
# SES_ACCESSKEY_ID=AKIATA3T2WIUTKFCYQVU
|
||||
# SES_SECRETKEY=HkJqRbr2/2NhbdHIxvl+4MamVYtk24+hbxcFpHFa
|
||||
# SES_REGION=us-west-2
|
||||
# SES_SQS_BOUNCE=https://sqs.us-west-2.amazonaws.com/208011964969/ses-bounce-dev1
|
||||
# SES_SQS_COMPLAINT=https://sqs.us-west-2.amazonaws.com/208011964969/ses-complaint-dev1
|
||||
#
|
||||
# DOMAIN=p01.bergx.io
|
||||
#
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_USER=bxmodules
|
||||
# DB_PASSWORD=LaiwRssM5QDy7j
|
||||
# DB_NAME=bxmodules
|
||||
#
|
||||
# SESSION_DB_HOST=127.0.0.1
|
||||
# SESSION_DB_USER=session
|
||||
# SESSION_DB_PASSWORD=LaiwRssM5QDy7j
|
||||
# SESSION_DB_NAME=session
|
||||
#
|
||||
# NSQLOOKUP_HOST='localhost'
|
||||
# NSQLOOKUP_PORT='4161'
|
||||
# NSQD_HOST='localhost'
|
||||
# NSQD_PORT='4150'
|
||||
#
|
||||
# # Loki settings
|
||||
# AUTOLOAD=true
|
||||
# AUTOSAVE=true
|
||||
#
|
||||
# # File storage configuration
|
||||
# STORAGE_ENDPOINT=https://s3.wasabisys.com
|
||||
# STORAGE_ACCESSKEY=JVVBXJPQ6S9KBBC0CCHE
|
||||
# STORAGE_SECRETKEY=9odWv7cwzOJOHkAhpU86NSKaQi6aBK3PfzHeYbzw
|
||||
# LOGO_BUCKET=bx-images
|
||||
#
|
||||
# EndOfEnv
|
||||
#
|
||||
# systemctl daemon-reload
|
||||
# systemctl start bergx
|
||||
systemctl restart nginx
|
||||
|
||||
# Init domains
|
||||
# domains=("p01.bergx.io" "www.bergx.io" "bergx.io")
|
||||
|
||||
# Certbot
|
||||
# add-apt-repository ppa:certbot/certbot -y
|
||||
# apt install -y python-certbot-nginx
|
||||
|
||||
# for elem in "${domains[@]}"; do
|
||||
# certbot_domains+=( "-d $elem" )
|
||||
# done
|
||||
#
|
||||
# certbot -m mason.payne@bergx.io --nginx "${certbot_domains[@]}"
|
||||
|
||||
exit 0
|
26
commands/bx-webpage/bx-webpage.conf
Normal file
26
commands/bx-webpage/bx-webpage.conf
Normal file
@ -0,0 +1,26 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name www.bergx.io;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name bergx.io;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name test.bergx.io bergx.io ~^(test.)?bergx.io ~^(www.)?bergx.io;
|
||||
keepalive_timeout 70;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/app.stormfolder.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/app.stormfolder.com/privkey.pem;
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
location / {
|
||||
root /Bergx/bx-webpage/dist;
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
@ -24,11 +24,19 @@ fi
|
||||
|
||||
# replace "-" with "_" for database username
|
||||
#MAINDB=${USER_NAME//[^a-zA-Z0-9]/_}
|
||||
# mysql -uroot -p${rootPassword} -e "show databases;"
|
||||
|
||||
mysql -uroot -p${rootPassword} -e "CREATE DATABASE ${MAINDB} /*\!40100 DEFAULT CHARACTER SET utf8 */;"
|
||||
mysql -uroot -p${rootPassword} -e "CREATE USER ${MAINDB}@'%' IDENTIFIED BY '${PASSWDDB}';"
|
||||
mysql -uroot -p${rootPassword} -e "GRANT ALL PRIVILEGES ON ${MAINDB}.* TO '${MAINDB}'@'%';"
|
||||
# mysql -uroot -p${rootPassword} -e "ALTER USER 'root'@'%' IDENTIFIED BY 'Passw0rd!';"
|
||||
# mysql -uroot -p${rootPassword} -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Passw0rd!';"
|
||||
# mysql -uroot -p${rootPassword} -e "CREATE DATABASE ${MAINDB} /*\!40100 DEFAULT CHARACTER SET utf8 */;"
|
||||
# mysql -uroot -p${rootPassword} -e "CREATE DATABASE Session /*\!40100 DEFAULT CHARACTER SET utf8 */;"
|
||||
# mysql -uroot -p${rootPassword} -e "CREATE USER ${MAINDB}@'%' IDENTIFIED BY '${PASSWDDB}';"
|
||||
# mysql -uroot -p${rootPassword} -e "GRANT ALL PRIVILEGES ON ${MAINDB}.* TO '${MAINDB}'@'%';"
|
||||
mysql -uroot -p${rootPassword} -e "GRANT ALL PRIVILEGES ON Session.* TO '${MAINDB}'@'%';"
|
||||
mysql -uroot -p${rootPassword} -e "FLUSH PRIVILEGES;"
|
||||
# mysql -uroot -p${rootPassword} -e "ALTER USER root@localhost IDENTIFIED BY 'Passw0rd!';"
|
||||
# mysql -uroot -p${rootPassword} -e "select Host, User, Password from mysql.user;"
|
||||
# mysql -uroot -p${rootPassword} -e "show databases;"
|
||||
|
||||
|
||||
exit 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
# Example Usage
|
||||
# ssh user@host "sudo -n bash -s" -- < ./commands/db-setup.sh 'rootPass' "maindb" "maindbPass"
|
||||
# ssh user@host "sudo -n bash -s" -- < ./commands/db/db-setup.sh 'rootPass' "maindb" "maindbPass"
|
||||
|
||||
if [ "$1" == "-h" ]; then
|
||||
echo "Usage:"
|
||||
@ -27,6 +27,8 @@ export DEBIAN_FRONTEND="noninteractive"
|
||||
if [ "$rootPassword" == "$confirmPassword" ]; then
|
||||
echo -e "mysql-server mysql-server/root_password password $rootPassword" | debconf-set-selections
|
||||
echo -e "mysql-server mysql-server/root_password_again password $rootPassword" | debconf-set-selections
|
||||
apt-get update
|
||||
apt-get dist-upgrade
|
||||
apt-get -y install mysql-server
|
||||
else
|
||||
echo "Passwords do not match cancelling the installation"
|
||||
|
16
commands/nginx/nginx-setup.sh
Normal file
16
commands/nginx/nginx-setup.sh
Normal file
@ -0,0 +1,16 @@
|
||||
# Example Usage
|
||||
# ssh user@host "sudo -n bash -s" -- < ./commands/nginx/nginx-setup.sh
|
||||
|
||||
if [ "$1" == "-h" ]; then
|
||||
echo "Usage:"
|
||||
echo " ./nginx-setup.sh"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
|
||||
apt-get update
|
||||
apt-get dist-upgrade
|
||||
apt-get -y install nginx
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user