diff --git a/README.md b/README.md index ed1609f..e2f8ac1 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ - MongoDB requires x86 architecture to run for v5+ versions. You can track [this issue](https://github.com/linux-odyssey/linux-odyssey/issues/166) for updates. +Windows user please refer to [docs/windows-setup.md](docs/windows-setup.md) for setup instructions. + ## Installation git clone https://github.com/lancatlin/linux-odyssey.git diff --git a/docker-compose.yml b/docker-compose.yml index 7be150e..f92fea5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,14 +13,14 @@ services: base: image: linuxodyssey/quest-base networks: - - players + - players build: context: . dockerfile: ./quests/Dockerfile extra_hosts: - 'host.docker.internal:host-gateway' volumes: - - ./config/ssh_key.pub:/ssh_key.pub:ro + # - ./config/ssh_key.pub:/ssh_key.pub:ro - ./quests/entrypoint.sh:/entrypoint.sh:ro networks: @@ -28,3 +28,4 @@ networks: players: name: linux-odyssey-players internal: false + external: true diff --git a/docs/windows-setup.md b/docs/windows-setup.md index 0a7204c..7479d42 100644 --- a/docs/windows-setup.md +++ b/docs/windows-setup.md @@ -1,69 +1,40 @@ # Windows Environment Setup -## Prerequisites +## Install WSL and Ubuntu -1. Have a computer with Windows 10 or later. -1. Install WSL and Ubuntu on Windows. -1. Enter Ubuntu terminal. +Please refer to the Official [Setup WSL](https://learn.microsoft.com/en-us/windows/wsl/setup/environment) on Microsoft's website. + +Run the following command in PowerShell as Administrator: + + wsl --install + +Then restart the computer. After restarting, you can open Ubuntu terminal by searching "Ubuntu" in Start menu. You will be prompted to create a new user account. Once you have done that, you can continue with the following steps. ## Setup Environment (In Ubuntu terminal) 1. Update and upgrade ``` - $ sudo apt-get update - $ sudo apt-get upgrade + sudo apt-get update + sudo apt-get upgrade ``` 1. Install Git ``` - $ sudo apt-get install git + sudo apt-get install git ``` 1. Install Node.js (Version 20.x) ``` - $ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - - $ sudo apt-get install nodejs + curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - + sudo apt-get install nodejs + sudo apt install build-essential + sudo npm install -g yarn ``` -1. [Install Docker](#install-docker) -1. [Install Python 2.7](#install-python-27) - -## Run the Project (In Ubuntu terminal) - -1. Installation - - ``` - $ git clone https://github.com/lancatlin/linux-odyssey.git - $ cd linux-odyssey - $ yarn install - ``` - -1. Docker setup - - ``` - $ docker compose pull - $ docker compose build - $ docker-compose up -d - ``` - - - - -1. Run the project - - ``` - $ yarn build - $ yarn dev - ``` - - - -## References - -### Install Docker +## Install Docker (Refer to [get.docker.com](https://get.docker.com/)) @@ -73,72 +44,98 @@ dependencies: 1. Download the script ``` - $ curl -fsSL https://get.docker.com -o install-docker.sh + curl -fsSL https://get.docker.com -o install-docker.sh ``` 1. verify the script's content ``` - $ cat install-docker.sh + cat install-docker.sh ``` 1. run the script with --dry-run to verify the steps it executes ``` - $ sh install-docker.sh --dry-run + sh install-docker.sh --dry-run ``` +**NOTE: the script will recommend you to use Docker Desktop instead, but we need to use Docker inside WSL for the backend to work.** Just ignore it and wait for the installation to finish. + 1. run the script either as root, or using sudo to perform the installation. ``` - $ sudo sh install-docker.sh + sudo sh install-docker.sh ``` 1. Verify the installation ``` - $ docker --version + docker --version ``` -### Install Python 2.7 - -1. Install required packages +1. Add your user to the docker group ``` - $ sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git + sudo usermod -aG docker $USER ``` -1. Install pyenv - - ``` - $ curl https://pyenv.run | bash - ``` - -1. Add following lines to bash configuration file (e.g. `~/.bashrc`, `~/.bash_profile`, `~/.zshrc`) - - ``` - export PATH="$HOME/.pyenv/bin:$PATH" - eval "$(pyenv init --path)" - eval "$(pyenv init -)" - eval "$(pyenv virtualenv-init -)" - ``` - -1. Restart the shell - -1. Install Python 2.7.18 using pyenv - - ``` - $ pyenv install 2.7.18 - ``` - -1. Set Python 2.7.18 as the global version - - ``` - $ pyenv global 2.7.18 - ``` + **NOTE: You need to create a new WSL terminal to apply the changes.** 1. Verify the installation ``` - $ python --version + docker ps ``` + This should return something like: + + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + +## Run the Project (In Ubuntu terminal) + +1. Clone the repository + + ``` + git clone https://github.com/lancatlin/linux-odyssey.git + cd linux-odyssey + ``` + + Optional: To open the project in VSCode, run the following command inside the project folder: + + ``` + code . + ``` + +1. Install dependencies + + ``` + yarn install + ``` + It is ok if there are some warnings and `gyp: ERR` errors, just verify there is `done` at the end. + +1. Copy the environment variables + + ``` + cp .env.sample .env + ``` + +1. Docker setup + + ``` + docker compose pull + docker compose build + docker compose up -d db + ``` + + + + +1. Run the project + + ``` + yarn build + yarn dev + ``` + + + +Enjoy! \ No newline at end of file