From 3c7a2da359cc3ad3bd1ccf034b7b670f1ffd2e50 Mon Sep 17 00:00:00 2001 From: Marwolf Date: Sat, 18 Aug 2018 12:12:37 -0400 Subject: [PATCH] Changes to support new design --- .env | 1 - Linux_Installer.sh | 35 ++++++++++++------- docker-compose.yml | 15 ++++---- etc/ghost/config.production.json | 2 +- etc/ghost/ghost/config.production.json | 29 ---------------- etc/nginx/HTTPS_default.conf.BAK | 48 ++++---------------------- etc/nginx/nginx.conf | 8 ++--- 7 files changed, 43 insertions(+), 95 deletions(-) delete mode 100644 etc/ghost/ghost/config.production.json diff --git a/.env b/.env index 9fcf5f1..6e499c7 100644 --- a/.env +++ b/.env @@ -1,7 +1,6 @@ #!/usr/bin/env bash # Ghost -GHOST_HOST=localhost/ghost GHOST_EMAIL=admin@openrsc.com GHOST_PASSWORD=malwareinfection GHOST_DATABASE_NAME=ghost diff --git a/Linux_Installer.sh b/Linux_Installer.sh index e03f53e..a3f249d 100755 --- a/Linux_Installer.sh +++ b/Linux_Installer.sh @@ -547,32 +547,43 @@ elif [ "$choice" == "2" ]; then unzip -o Game/client/cache.zip -d ~/OpenRSC echo "" echo "" - echo "Importing the databases." - echo "" - sudo make import-game - sudo make import-ghost - echo "" - echo "" - echo "Creating a backup of your current databases as \"Docker-Home/data/db/db.sql\"" - echo "" - sudo make backup - echo "" - echo "" echo "Next is manual file editing for the website domain and SQL user/pass." echo "" + echo "It is suggested that you first navigate to your VPS's http://domain:9000" + echo "" + echo "Create a new SQL user and password, grant all permissions, then remove the others." + echo "" + echo "" + echo "When finished, it will be time to edit the files that rely on that new SQL user." + echo "" echo "(Use Ctrl + X to save each file when done editing) - Press enter when ready." read next sudo nano .env sudo nano Game/client/src/org/openrsc/client/Config.java sudo nano Game/Launcher/src/Main.java sudo nano Game/server/config/config.xml + sudo nano etc/ghost/config.production.json echo "" echo "" - echo "File edits complete. Restarting Docker containers." + echo "File edits complete." + echo "" + echo "" + echo "Importing the databases." + echo "" + sudo make import-game + sudo make import-ghost + echo "" + echo "" + echo "Restarting Docker containers" echo "" sudo make stop && sudo make start echo "" echo "" + echo "Creating a backup of your current databases as \"Docker-Home/data/db/db.sql\"" + echo "" + sudo make backup + echo "" + echo "" echo "Ready to launch \"./Linux_Fetch_Updates_Production.sh\" - Press enter when ready." echo "" echo "" diff --git a/docker-compose.yml b/docker-compose.yml index 56ef571..9d49563 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,7 +38,9 @@ services: user: root command: chown -R 1001:1001 /bitnami volumes: - - "./data/db/mysq:/bitnami/mariadb" + - "./data/db/mysq:/bitnami/mariadb" + depends_on: + - nginx mysqldb: image: bitnami/mariadb:latest @@ -60,7 +62,7 @@ services: - "./data/db/mysq:/bitnami/mariadb" - "./etc/mariadb/innodb.cnf:/bitnami/mariadb/conf/innodb.cnf:ro" depends_on: - - nginx + - fix-mariadb-permissions tomcat: image: tomcat:latest @@ -79,7 +81,10 @@ services: user: root command: chown -R 1001:1001 /bitnami/ghost volumes: - - "./etc/ghost:/bitnami/ghost" + - "./etc/ghost:/bitnami/ghost" + depends_on: + - mysqldb + - nginx ghost: image: bitnami/ghost:latest @@ -98,12 +103,10 @@ services: - GHOST_DATABASE_PASSWORD=${MARIADB_ROOT_PASSWORD} - GHOST_DATABASE_NAME=${GHOST_DATABASE_NAME} - ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD} - - GHOST_HOST=${GHOST_HOST} - GHOST_EMAIL=${GHOST_EMAIL} - GHOST_PASSWORD=${GHOST_PASSWORD} depends_on: - - mysqldb - - nginx + - fix-ghost-permissions php: image: bitnami/php-fpm:latest diff --git a/etc/ghost/config.production.json b/etc/ghost/config.production.json index 476f8da..2f103a7 100644 --- a/etc/ghost/config.production.json +++ b/etc/ghost/config.production.json @@ -9,7 +9,7 @@ "database": "ghost" } }, - "url": "http://localhost:2368/blog", + "url": "http://localhost/blog", "server": { "port": 2368, "host": "0.0.0.0" diff --git a/etc/ghost/ghost/config.production.json b/etc/ghost/ghost/config.production.json deleted file mode 100644 index 476f8da..0000000 --- a/etc/ghost/ghost/config.production.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "database": { - "client": "mysql", - "connection": { - "host": "mysql", - "port": 3306, - "password": "root", - "user": "root", - "database": "ghost" - } - }, - "url": "http://localhost:2368/blog", - "server": { - "port": 2368, - "host": "0.0.0.0" - }, - "mail": { - "transport": "Direct" - }, - "logging": { - "transports": [ - "file" - ] - }, - "process": "local", - "paths": { - "contentPath": "/opt/bitnami/ghost/content" - } -} diff --git a/etc/nginx/HTTPS_default.conf.BAK b/etc/nginx/HTTPS_default.conf.BAK index 4fefa52..88bda15 100755 --- a/etc/nginx/HTTPS_default.conf.BAK +++ b/etc/nginx/HTTPS_default.conf.BAK @@ -17,41 +17,6 @@ server { rewrite ^ https://$http_host$request_uri? permanent; #Redirect traffic to HTTPS - root /app; - index index.html index.htm index.php index.jsp; - - client_max_body_size 100M; - - location / { - try_files $uri $uri/index.html; - } - - ####### Proxies ####### - # PHP proxy - location ~ \.php$ { - fastcgi_pass php:9001; - fastcgi_index index.php; - include fastcgi.conf; - } - - # Ghost proxy - location /blog { - proxy_pass http://ghost; - proxy_set_header Host $http_host; # required for docker client's sake - proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_read_timeout 900; - } - - # Tomcat proxy - location ~ \.(do|jspa|obr|jsp|txt|zip) { - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://tomcat; - } - } # HTTPS @@ -77,20 +42,21 @@ server { ssl_trusted_certificate /etc/letsencrypt/live/${NGINX_HOST}/chain.pem; root /app; - index index.html index.htm index.php index.jsp; + index index.jsp index.html index.htm index.php; client_max_body_size 100M; location / { - try_files $uri $uri/index.html; + try_files $uri $uri/ =404; } ####### Proxies ####### # PHP proxy location ~ \.php$ { - fastcgi_pass php:9001; - fastcgi_index index.php; - include fastcgi.conf; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://php; } # Ghost proxy @@ -104,7 +70,7 @@ server { } # Tomcat proxy - location ~ \.(do|jspa|obr|jsp|txt|zip) { + location ~ \.jsp$ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index b9c0563..594303f 100755 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -15,15 +15,13 @@ server { error_log /opt/bitnami/nginx/logs/error.log; access_log /opt/bitnami/nginx/logs/access.log; - #rewrite ^ https://$http_host$request_uri? permanent; #Redirect traffic to HTTPS - root /app; - index index.html index.htm index.php index.jsp; + index index.jsp index.html index.htm index.php; client_max_body_size 100M; location / { - try_files $uri $uri/index.html; + try_files $uri $uri/ =404; } ####### Proxies ####### @@ -45,7 +43,7 @@ server { } # Tomcat proxy - location ~ \.(do|jspa|obr|jsp|txt|zip) { + location ~ \.jsp$ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;