diff --git a/Backup Databases.cmd b/Backup Databases.cmd new file mode 100644 index 0000000..e721477 --- /dev/null +++ b/Backup Databases.cmd @@ -0,0 +1,3 @@ + @echo off +Windows\make backup-windows +pause \ No newline at end of file diff --git a/Delete Local Repositories.cmd b/Delete Local Repositories.cmd new file mode 100644 index 0000000..a2462bf --- /dev/null +++ b/Delete Local Repositories.cmd @@ -0,0 +1,5 @@ + @echo off +Windows\make flush-windows +cls +echo Local repositories have been deleted. +pause \ No newline at end of file diff --git a/First time setup.cmd b/First time setup.cmd new file mode 100644 index 0000000..e9a0af4 --- /dev/null +++ b/First time setup.cmd @@ -0,0 +1,29 @@ + @echo off +cls +docker login +cls +echo Attempting to stop any running Docker containers. +echo: +Windows\make stop +cls +echo Starting Docker containers and downloading what is needed. This may take a while the first time. +echo: +Windows\make start + +cls +echo Downloading a copy of the Open-RSC-Website repository +echo: +Windows\make clone-windows-website +cls +echo Downloading a copy of the Open-RSC-Game repository +echo: +Windows\make clone-windows-game +cls +echo Waiting for 5 seconds to give the MySQL server time to start before importing the databases. +echo: +timeout 5 +Windows\make import-windows + +cls +echo First time setup is now complete. Visit http://localhost in your browser to verify. +pause \ No newline at end of file diff --git a/Makefile b/Makefile index 70a370c..62f9d35 100644 --- a/Makefile +++ b/Makefile @@ -36,30 +36,57 @@ restart: init clone: @$(shell cd Website && git clone https://github.com/Marwolf/Open-RSC-Website.git) @$(shell mkdir Game && cd Game && git clone https://github.com/Marwolf/Open-RSC-Game.git) - @$(shell sudo chmod -R 777 Website/Open-RSC-Website && sudo chmod -R 777 Game/Open-RSC-Game && sudo chmod 644 Website/Open-RSC-Website/board/config.php) + #@$(shell sudo chmod -R 777 Website/Open-RSC-Website && sudo chmod -R 777 Game/Open-RSC-Game && sudo chmod 644 Website/Open-RSC-Website/board/config.php) + +clone-windows-website: + @git clone https://github.com/Marwolf/Open-RSC-Website.git Website/Open-RSC-Website + #icacls Website/Open-RSC-Website /grant Everyone:F /t + +clone-windows-game: + @git clone https://github.com/Marwolf/Open-RSC-Game.git Game/Open-RSC-Game + #icacls Game/Open-RSC-Game /grant Everyone:F /t pull: @$(shell cd Website/Open-RSC-Website && git pull) @$(shell cd Game/Open-RSC-Game && git pull) +pull-windows: + @cd Website/Open-RSC-Website && git pull + @cd Game/Open-RSC-Game && git pull + logs: @docker-compose logs -f backup: @mkdir -p $(MYSQL_DUMPS_DIR) @docker exec $(shell docker-compose ps -q mysqldb) mysqldump --all-databases -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" > Website/$(MYSQL_DUMPS_DIR)/db.sql 2>/dev/null - @make resetOwner + +backup-windows: + @docker exec -i mysql mysqldump --all-databases -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" > Website/$(MYSQL_DUMPS_DIR)/db.sql restore: @docker exec -i $(shell docker-compose ps -q mysqldb) mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Website/$(MYSQL_DUMPS_DIR)/db.sql 2>/dev/null +restore-windows: + @docker exec -i mysql mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Website/$(MYSQL_DUMPS_DIR)/db.sql + import: @docker exec -i $(shell docker-compose ps -q mysqldb) mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Game/Open-RSC-Game/Databases/openrsc_config.sql 2>/dev/null @docker exec -i $(shell docker-compose ps -q mysqldb) mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Game/Open-RSC-Game/Databases/openrsc_logs.sql 2>/dev/null @docker exec -i $(shell docker-compose ps -q mysqldb) mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Game/Open-RSC-Game/Databases/openrsc.sql 2>/dev/null @docker exec -i $(shell docker-compose ps -q mysqldb) mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Website/Open-RSC-Website/openrsc_forum.sql 2>/dev/null +import-windows: + @docker exec -i mysql mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Website/Open-RSC-Website/openrsc_forum.sql + @docker exec -i mysql mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Game/Open-RSC-Game/Databases/openrsc_logs.sql + @docker exec -i mysql mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Game/Open-RSC-Game/Databases/openrsc_config.sql + @docker exec -i mysql mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < Game/Open-RSC-Game/Databases/openrsc.sql + flush: @$(shell rm -rf Website/Open-RSC-Website && rm -rf Game/Open-RSC-Game) +flush-windows: + @rmdir "Website/Open-RSC-Website" /s /Q + @rmdir "Game/Open-RSC-Game" /s /Q + .PHONY: clean test code-sniff init diff --git a/Pull Repository Updates.cmd b/Pull Repository Updates.cmd new file mode 100644 index 0000000..4b6d37b --- /dev/null +++ b/Pull Repository Updates.cmd @@ -0,0 +1,6 @@ + @echo off +cls +echo Attempting to pull the latest repository updates. +echo: +Windows\make pull-windows +pause \ No newline at end of file diff --git a/README.md b/README.md index 35a45e3..5d33678 100644 --- a/README.md +++ b/README.md @@ -10,25 +10,12 @@ ___ ## Install prerequisites -This project has been created for `(Linux/MacOS)`. +This project has been created for `(Windows, Linux, and OS X)`. Requisites: * [Git](https://git-scm.com/downloads) * [Docker](https://docs.docker.com/engine/installation/) -* [Docker Compose](https://docs.docker.com/compose/install/) - -Check if `docker-compose` is already installed by entering the following command: - -```sh -which docker-compose -``` - -On Ubuntu and Debian these are available in the meta-package build-essential. On other distributions, you may need to install the GNU C++ compiler separately. - -```sh -sudo apt install build-essential -``` This project uses the following ports: @@ -54,6 +41,13 @@ Go to the project directory: cd Open-RSC-Docker ``` +___ + +## Important! + +If you are using Windows, open Docker and make your drives available to your Docker containers: + +![Shared drives setting](https://i.imgur.com/6YsGkoZ.png) ___ @@ -62,7 +56,11 @@ ___ 1. Perform first time setup and start the Docker application: ```sh - ./first-time-setup.sh + OS X/Linux: ./first-time-setup.sh + ``` + + ```sh + Windows: "First time setup.cmd" ``` **Please wait this might take a several minutes...** @@ -75,39 +73,73 @@ ___ 3. Backup your databases: ```sh - ./backup-database.sh + OS X/Linux: ./backup-database.sh + ``` + + ```sh + Windows: "Backup Databases.cmd" ``` 4. Restore your databases: ```sh - ./restore-database.sh + OS X/Linux: ./restore-database.sh ``` -5. Get help: - ```sh - sudo make help + Windows: "Restore Databases.cmd" ``` -6. Stop the application: +5. Stop the application: ```sh - ./stop.sh + OS X/Linux: ./stop.sh ``` -7. Start the application: - ```sh - ./start.sh + Windows: "Stop Containers.cmd" ``` -8. Restart the application: +6. Start the application: + + ```sh + OS X/Linux: ./start.sh + ``` + + ```sh + Windows: "Start Containers.cmd" + ``` + +7. Restart the application: ```sh ./restart.sh ``` + ```sh + Windows: "Restart Containers.cmd" + ``` + +8. View container logs: + +```sh +./view-logs.sh +``` + +```sh +Windows: "View Container Logs.cmd" +``` + +9. Pull repository updates: + +```sh +./pull-updates.sh +``` + +```sh +Windows: "Pull Repository Updates.cmd" +``` + ___ ## Additional commands for troubleshooting use diff --git a/Restart Containers.cmd b/Restart Containers.cmd new file mode 100644 index 0000000..4241b68 --- /dev/null +++ b/Restart Containers.cmd @@ -0,0 +1,3 @@ + @echo off +Windows\make restart +pause \ No newline at end of file diff --git a/Restore Databases.cmd b/Restore Databases.cmd new file mode 100644 index 0000000..c361fda --- /dev/null +++ b/Restore Databases.cmd @@ -0,0 +1,3 @@ + @echo off +Windows\make restore-windows +pause \ No newline at end of file diff --git a/Start Containers.cmd b/Start Containers.cmd new file mode 100644 index 0000000..3236894 --- /dev/null +++ b/Start Containers.cmd @@ -0,0 +1,4 @@ + @echo off +Windows\make start + +pause \ No newline at end of file diff --git a/Stop Containers.cmd b/Stop Containers.cmd new file mode 100644 index 0000000..ef30849 --- /dev/null +++ b/Stop Containers.cmd @@ -0,0 +1,3 @@ + @echo off +Windows\make stop +pause \ No newline at end of file diff --git a/View Container Logs.cmd b/View Container Logs.cmd new file mode 100644 index 0000000..ee48f8d --- /dev/null +++ b/View Container Logs.cmd @@ -0,0 +1,3 @@ + @echo off +Windows\make logs +pause \ No newline at end of file diff --git a/Windows/libgcc_s_dw2-1.dll b/Windows/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..a98ce46 Binary files /dev/null and b/Windows/libgcc_s_dw2-1.dll differ diff --git a/Windows/libiconv-2.dll b/Windows/libiconv-2.dll new file mode 100644 index 0000000..2cc0be9 Binary files /dev/null and b/Windows/libiconv-2.dll differ diff --git a/Windows/libintl-8.dll b/Windows/libintl-8.dll new file mode 100644 index 0000000..245830b Binary files /dev/null and b/Windows/libintl-8.dll differ diff --git a/Windows/make.exe b/Windows/make.exe new file mode 100644 index 0000000..4201fb4 Binary files /dev/null and b/Windows/make.exe differ diff --git a/first-time-setup.sh b/first-time-setup.sh index 866e307..528c769 100755 --- a/first-time-setup.sh +++ b/first-time-setup.sh @@ -1,5 +1,6 @@ #!/bin/bash +docker login sudo make stop sudo make start sudo make clone diff --git a/pull-updates.sh b/pull-updates.sh new file mode 100644 index 0000000..7b1b621 --- /dev/null +++ b/pull-updates.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo make pull