Set up a WSL development environment
Install WSL
Open PowerShell (or Windows Command Prompt) and enter:
|
|
For Ubuntu or Debian, update and upgrade packages, use the command in bash:
|
|
Proxy and Firewall
|
|
|
|
Windows IP Address**
|
|
WSL IP Address
|
|
WSL access Windows
Add “allow” rule to Windows firewall for WSL2 network
Open PowerShell as Admin and enter the following command:
|
|
Windows Access WSL
Windows access application in WSL by <wsl-ip> and <port>
Disable Microsoft Defender Firewall from PowerShell
|
|
Re-enable firewall from PowerShell
|
|
Test
|
|
|
|
Proxy
|
|
|
|
v2rayN
“允许来自局域网的连接”
Install make
|
|
SSH key and GitHub
|
|
|
|
Add your key to your account via the GitHub website.
|
|
Install Docker Desktop WSL 2 backend on Windows
-
Download [Docker Desktop for Windows](https://desktop.docker.com/win/main/amd64/Docker Desktop Installer.exe?_gl=110t7s1l_gaNTM4MDE1OTE2LjE2ODYyODc3OTY._ga_XJWPQMJYHQ*MTY4NjI4Nzc5Ni4xLjEuMTY4NjI4ODgzNC41OC4wLjA.).
-
Follow the usual installation instructions to install Docker Desktop. If you are running a supported system, Docker Desktop prompts you to enable WSL 2 during installation. Read the information displayed on the screen and enable WSL 2 to continue.
-
Start Docker Desktop from the Windows Start menu.
-
From the Docker menu, select Settings and then General.
-
Select the Use WSL 2 based engine check box.
If you have installed Docker Desktop on a system that supports WSL 2, this option is enabled by default.
-
Select Apply & Restart.
Enabling Docker support in WSL 2 distros:
- When Docker Desktop starts, go to Settings > Resources > WSL Integration.
- Enable integration with additional distros.
change Disk image location:
- When Docker Desktop starts, go to Settings > Resources > Advanced.
- Set Disk image location from
%localappdata%\Docker\wsltoD:\docker\wsl
Setup Docker Registry Mirroring
Add registry-mirrors property by going to settings > Docker Engine inside Docker Desktop application.
|
|
Visual Studio Code
Open VS Code and install the Remote - WSL extension. This extension allows you to work with code inside the Linux distro and your IDE client still on Windows.
Now, you can start working in VS Code remotely. To do this, open your terminal and type:
|
|
|
|
Install Devstack
Service List
| Service | URL | Type | Role |
|---|---|---|---|
| lms | http://localhost:18000/ | Python/Django | Default |
| studio | http://localhost:18010/ | Python/Django | Default |
| forum | http://localhost:44567/api/v1/ | Ruby/Sinatra | Default |
| discovery | http://localhost:18381/api-docs/ | Python/Django | Default |
| ecommerce | http://localhost:18130/dashboard/ | Python/Django | Default |
| credentials | http://localhost:18150/api/v2/ | Python/Django | Default |
| edx_notes_api | http://localhost:18120/api/v1/ | Python/Django | Default |
| frontend-app-learning | http://localhost:2000/ | MFE (React.js) | Default |
| frontend-app-payment | http://localhost:1998/ | MFE (React.js) | Default |
| frontend-app-publisher | http://localhost:18400/ | MFE (React.js) | Default |
| frontend-app-gradebook | http://localhost:1994/ | MFE (React.js) | Default |
| frontend-app-authn | http://localhost:1999/ | MFE (React.js) | Default |
| registrar | http://localhost:18734/api-docs/ | Python/Django | Extra |
| frontend-app-program-console | http://localhost:1976/ | MFE (React.js) | Extra |
| frontend-app-library-authoring | http://localhost:3001/ | MFE (React.js) | Extra |
| frontend-app-course-authoring | http://localhost:2001/ | MFE (React.js) | Extra |
| frontend-app-account | http://localhost:1997/ | MFE (React.js) | Extra |
| frontend-app-profile | http://localhost:1995/ | MFE (React.js) | Extra |
| xqueue | http://localhost:18040/api/v1/ | Python/Django | Extra |
| coursegraph | http://localhost:7474/browser | Tooling (Java) | Extra |
| insights | http://localhost:18110 | Python/Django | Extra |
| analyticsapi | http://localhost:19001 | Python/Django | Extra |
| frontend-app-ora-grading | http://localhost:1993 | MFE (React.js) | Extra |
Setup and run
open a WSL terminal (Ubuntu for example) and enter:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pull any changes made to the various images
|
|
configure the various services
|
|
|
|
|
|
|
|
Start services
|
|
Commands
Start the desired services
|
|
To stop a service
|
|
Stop service and remove the container
|
|
Access to one of the services
|
|
View the logs of a specific service container
|
|
Access
|
|
|
|
Build system
invoke
paver
Tasks
-
task
You designate a function as being a task by using the @task decorator.
1 2 3 4 5from paver.easy import task @task def mytask(args): pass -
consume_args
The @consume_args decorator tells Paver that all command line arguments following this task’s name should be passed to the task.
1 2 3 4 5 6from paver.easy import task, consume_args @task @consume_args def help(args, help_function): pass -
consume_nargs
specifying a number of consumed arguments
1 2 3 4 5 6from paver.easy import task, consume_nargs @task @consume_nargs(3) def mytask(args): pass -
cmdopts
1 2 3 4 5 6 7 8from paver.easy import task, cmdopts @task @cmdopts([ ('username=', 'u', 'Username to use when logging in to the servers') ]) def deploy(options): pass@cmdopts takes a list of tuples, each with long option name, short option name and help text. If there’s an “=” after the long option name, that means that the option takes a parameter. Otherwise, the option is assumed to be boolean. The command line options set in this manner are all added to the
optionsunder a namespace matching the name of the task. In the case above,options.deploy.usernamewould be set if the user ran paver deploy -u my-user-name. -
needs
specify that a task depends on another task running first with the @needs decorator. A given task will only run once as a dependency for other tasks.
1 2 3 4 5 6 7 8 9from paver.easy import task, needs, cmdopts @task @needs(['deploy_to_linux']) @cmdopts([ ('username=', 'u', 'Username to use when logging in to the servers') ], share_with=['deploy_to_linux']) def deploy(options): pass -
call_task
call an appropriate task in the middle of another task using call_task
1 2 3from paver.easy import call_task call_task('say_hello', options={}, args = []) -
sh
sh(command, capture=False, ignore_error=False, cwd=None, env=None)
1 2 3from paver.easy import sh sh("rm -rf test_root/log/auto_screenshots/*")If capture is True, the output of the command will be captured and returned as a string. If the command has a non-zero return code raise a BuildFailure. You can pass ignore_error=True to allow non-zero return codes to be allowed to pass silently, silently into the night. If you pass cwd=’some/path’ paver will chdir to ‘some/path’ before exectuting the command. env is a dictionary of environment variables.
|
|
|
|
|
|
|
|
Command Line
|
|
rake
webpack
Reference
Set up a WSL development environment