doc: update Windows setup guide

This commit is contained in:
Justin Lin committed 2024-10-20 20:06:39 +08:00
1 parent ba251fb933
commit 860b257ea7
3 files changed
+85 -85

No files matched your search

+2
View File
@@ -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. - 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 ## Installation
git clone https://github.com/lancatlin/linux-odyssey.git git clone https://github.com/lancatlin/linux-odyssey.git
+3 -2
View File
@@ -13,14 +13,14 @@ services:
base: base:
image: linuxodyssey/quest-base image: linuxodyssey/quest-base
networks: networks:
- players - players
build: build:
context: . context: .
dockerfile: ./quests/Dockerfile dockerfile: ./quests/Dockerfile
extra_hosts: extra_hosts:
- 'host.docker.internal:host-gateway' - 'host.docker.internal:host-gateway'
volumes: volumes:
- ./config/ssh_key.pub:/ssh_key.pub:ro # - ./config/ssh_key.pub:/ssh_key.pub:ro
- ./quests/entrypoint.sh:/entrypoint.sh:ro - ./quests/entrypoint.sh:/entrypoint.sh:ro
networks: networks:
@@ -28,3 +28,4 @@ networks:
players: players:
name: linux-odyssey-players name: linux-odyssey-players
internal: false internal: false
external: true
+80 -83
View File
@@ -1,69 +1,40 @@
# Windows Environment Setup # Windows Environment Setup
## Prerequisites ## Install WSL and Ubuntu
1. Have a computer with Windows 10 or later. Please refer to the Official [Setup WSL](https://learn.microsoft.com/en-us/windows/wsl/setup/environment) on Microsoft's website.
1. Install WSL and Ubuntu on Windows.
1. Enter Ubuntu terminal. 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) ## Setup Environment (In Ubuntu terminal)
1. Update and upgrade 1. Update and upgrade
``` ```
$ sudo apt-get update sudo apt-get update
$ sudo apt-get upgrade sudo apt-get upgrade
``` ```
1. Install Git 1. Install Git
``` ```
$ sudo apt-get install git sudo apt-get install git
``` ```
1. Install Node.js (Version 20.x) 1. Install Node.js (Version 20.x)
``` ```
$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
$ sudo apt-get install nodejs sudo apt-get install nodejs
sudo apt install build-essential
sudo npm install -g yarn
``` ```
1. [Install Docker](#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
```
<!-- Check folder ./config exist and is empty -->
<!-- Check .env file exist -->
1. Run the project
```
$ yarn build
$ yarn dev
```
<!-- Check ./config/ssh_key.pub is a file not a folder -->
## References
### Install Docker
(Refer to [get.docker.com](https://get.docker.com/)) (Refer to [get.docker.com](https://get.docker.com/))
@@ -73,72 +44,98 @@ dependencies:
1. Download the script 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 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 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. 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 1. Verify the installation
``` ```
$ docker --version docker --version
``` ```
### Install Python 2.7 1. Add your user to the docker group
1. Install required packages
``` ```
$ 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 **NOTE: You need to create a new WSL terminal to apply the changes.**
```
$ 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
```
1. Verify the installation 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
```
<!-- Check folder ./config exist and is empty -->
<!-- Check .env file exist -->
1. Run the project
```
yarn build
yarn dev
```
<!-- Check ./config/ssh_key.pub is a file not a folder -->
Enjoy!