Skip to content

Commit a62c496

Browse files
authored
Cleanup old scripts. Documentation - part 1. (#448)
* Cleanup old scripts. Documentation - part 1. * Fix typo.
1 parent 4f07bf2 commit a62c496

27 files changed

+60
-733
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ server/manifestmergetool/bin/*
4141

4242
.vscode/*
4343
/server/docker/victoria-metrics-data/*
44-
/server/docker/grafana-data/*
44+
/server/docker/grafana-data/*
45+
/dynamo_home/
46+
/dynamo_home/**

.gitmodules

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +0,0 @@
1-
[submodule "server/scripts/shared"]
2-
path = server/scripts/shared
3-
url = [email protected]:defold/aws-build-tools.git
4-
5-
[submodule "server/scripts/task-definitions"]
6-
path = server/scripts/task-definitions
7-
url = [email protected]:defold/extender-task-definitions.git

README.md

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2,95 +2,8 @@
22

33
Extender is a build server that builds native extensions of the Defold engine. The build server can either by run using Docker or as a stand-alone server running on macOS.
44

5-
6-
## Running on Docker
7-
This describes how to build and run the extender server using Docker. It involves 4 steps:
8-
9-
1. Download and prepare required packages
10-
2. Serve the required packages
11-
3. Build the Docker image
12-
4. Run the Docker image in a container
13-
14-
15-
### Prerequisites
16-
Make sure you have [Docker](https://www.docker.com) installed and running.
17-
18-
### Download and prepare required packages
19-
Most of the SDKs used by Extender server have licenses that prevent third party redistribution. To efficiently work with the build server it is recommended to package the SDKs and serve them from a private URL. The URL is defined as the DM_PACKAGES_URL environment variable.
20-
21-
The [Dockerfile](./server/docker-base/Dockerfile) lists the actual packages needed per platform:
22-
23-
* Clang LLVM: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L49-L51
24-
* HTML5
25-
* Emscripten: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L103
26-
* Windows
27-
* Microsoft Visual Studio 2019: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L103
28-
* Windows Kits: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L169
29-
* Android:
30-
* NDK and SDK: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L259-L260
31-
* iOS and macOS
32-
* iOS, macOS, Xcode - previous version: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L475-L485
33-
* iOS, macOS, Xcode - latest version: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L488-L496
34-
35-
We have prepared scripts to package the required files. Use the scripts in the [defold/scripts/package](https://github.com/defold/defold/tree/dev/scripts/package) folder to create these packages.
36-
37-
NOTE: If you only plan to use the extender server to build for a single platform you may remove the setup steps for the other platforms to speed up the build process.
38-
39-
### Serve the required packages
40-
When the packages are downloaded you need to make them available when the Docker container is built. The recommended way is to serve the files using Python:
41-
42-
```sh
43-
# Using python 2
44-
$ export DM_PACKAGES_URL=http://localhost
45-
$ cd local_sdks && python -m SimpleHTTPServer
46-
```
47-
48-
```sh
49-
# Using python 3
50-
$ export DM_PACKAGES_URL=http://localhost:9999
51-
$ cd local_sdks && python -m http.server 9999
52-
```
53-
54-
### Build the Docker image
55-
Build the Extender Docker image by running:
56-
57-
```sh
58-
./server/scripts/build.sh
59-
```
60-
61-
To speed things up, tests can be disabled by passing `-xtest` to the command line.
62-
63-
```sh
64-
$ ./server/scripts/build.sh -xtest
65-
```
66-
67-
NOTE: The first time you build it will take a while (approx. 45 minutes). After that the Docker cache will speed it up.
68-
69-
NOTE: For Windows, I ran this using Git Bash. It may be possible to speed it up by creating a .bat file for it, and running it in the Command Prompt.
70-
71-
72-
### Run the Docker image in a container
73-
Start the container based on the Docker image that was built by running:
74-
75-
Bash:
76-
77-
```sh
78-
$ ./server/scripts/run-local.sh
79-
```
80-
81-
Command Prompt:
82-
83-
```cmd
84-
> server\scripts\run-local.bat
85-
```
86-
87-
The Extender server is now available on port `http://localhost:9000`
88-
89-
90-
### Stop the server
91-
You can stop the server by pressing `Ctrl-C` from the terminal prompt where it was started.
92-
93-
NOTE: On Windows, it may be that the Ctrol+C doesn't work. Then you can stop the container using the Docker Desktop client.
5+
* Server description and setup/run instructions - [link](/server/README.md)
6+
* Debugging FAQ - [link](/README_DEBUGGING.md)
947

958
---
969

README_AWS.md

Lines changed: 0 additions & 124 deletions
This file was deleted.

README_DEBUGGING.md

Lines changed: 35 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,11 @@ There is a debug script that you can run to download a specific SDK version, or
1212

1313
$ ./server/scripts/debug_defoldsdk.py [<sha1>]
1414

15-
This downloads the latest sdk to the folder `defoldsdk/<sha1>/defoldsdk`. It also sets the environment variable `DYNAMO_HOME` and then starts the extender server.
15+
This downloads the latest sdk to the folder `defoldsdk/<sha1>/defoldsdk`; creates link from `defoldsdk/<sha1>/defoldsdk` to `./dynamo_home`; sets the environment variable `DYNAMO_HOME` and then starts the extender server with profile `all`. If you want to run docker compose with other profiles - it can be done via COMPOSE_PROFILES variable. For example
1616

17-
## Building .proto files
18-
19-
If you are building a native extension that has .proto files, and you are using a non-Linux DYNAMO_HOME, then chances are that you don't have the `libdlib_shared.so` file installed.
20-
21-
It is needed for building the proto files, and you can install it from a previous defoldsdk.
22-
23-
* Download the defoldsdk.zip from d.defold.com
24-
* Extract the file to `${DYNAMO_HOME}/lib/x86_64-linux`:
25-
26-
$ unzip -j defoldsdk.zip defoldsdk/lib/x86_64-linux/libdlib_shared.so -d ${DYNAMO_HOME}/lib/x86_64-linux
17+
```sh
18+
COMPOSE_PROFILES=web,windows python ./server/scripts/debug_defoldsdk.py
19+
```
2720

2821
# Environment variables
2922

@@ -34,20 +27,33 @@ It is needed for building the proto files, and you can install it from a previou
3427
* **DM_DEBUG_JOB_UPLOAD** - Output the file names in the received payload
3528
* **DYNAMO_HOME** - If set, used as the actual SDK for the builds
3629

37-
Note: if you wish to add more of these, remember to also add them to `server/scripts/run-local.sh` and `server\scripts\run-local.bat`
30+
That variables can be pass to `python ./server/scripts/debug_defoldsdk.py` or to `docker compose` command. For example
3831

39-
# Debug the Docker container
32+
```sh
33+
DM_DEBUG_COMMANDS=1 DM_DEBUG_JOB_UPLOAD=1 docker compose -f ./server/docker/docker-compose.yml --profile linux up
34+
```
4035

41-
Run the following command when the container is running:
36+
## Building .proto files
4237

43-
Bash:
44-
```
45-
$ ./server/scripts/debug-local.sh
46-
```
38+
If you are building a native extension that has .proto files, and you are using a non-Linux DYNAMO_HOME, then chances are that you don't have the `libdlib_shared.so` file installed.
39+
40+
It is needed for building the proto files, and you can install it from a previous defoldsdk.
41+
42+
* Download the defoldsdk.zip from d.defold.com
43+
* Extract the file to `${DYNAMO_HOME}/lib/x86_64-linux`:
4744

48-
Command Prompt:
45+
$ unzip -j defoldsdk.zip defoldsdk/lib/x86_64-linux/libdlib_shared.so -d ${DYNAMO_HOME}/lib/x86_64-linux
46+
47+
# Debug the Docker container
48+
49+
List all running containers:
50+
```sh
51+
docker ps -f name=extender --format "table {{.ID}}\t{{.Names}}"
4952
```
50-
> server\scripts\debug-local.bat
53+
54+
Find container id you need and run following command
55+
```sh
56+
docker exec -uextender -it <container_id> /bin/bash
5157
```
5258

5359
The command will connect to the container using the `extender` user, and executes bash.
@@ -56,44 +62,24 @@ The command will connect to the container using the `extender` user, and execute
5662

5763
## Preparation
5864

59-
* For locally built SDK's (in DYNAMO_HOME), it's good to map the same folder path locally as is in the Docker container
60-
61-
$ ln -s $DYNAMO_HOME /dynamo_home
62-
63-
* Set the `DM_DEBUG_JOB_FOLDER` to a static folder, which both your computer and the Docker container can reach.
65+
* For locally built SDK's (in DYNAMO_HOME), it's good to map the same folder path locally as is in the Docker container. Create a symlink to ./dynamo_home folder:
66+
```sh
67+
ln -sf $DYNAMO_HOME ./dynamo_home
68+
```
69+
* Run docker compose with following environment variables:
70+
```sh
71+
DM_DEBUG_JOB_FOLDER=/dynamo_home/job123456 DM_DEBUG_COMMANDS=1 docker compose -f ./server/docker/docker-compose.yml --profile linux up
72+
```
73+
Set the `DM_DEBUG_JOB_FOLDER` to a static folder, which both your computer and the Docker container can reach.
6474
E.g. `DM_DEBUG_JOB_FOLDER=/dynamo_home/job123456`
6575
This will help when you debug the generated engine executable, since the debugger will find the object files on your local drive.
6676

67-
* Build the container (if it wasn't already built):
68-
69-
$ ./server/scripts/build.sh -xtest
70-
71-
* Run the server
72-
73-
$ DM_DEBUG_JOB_FOLDER=/dynamo_home/job123456 DM_DEBUG_COMMANDS=1 ./server/scripts/run-local.sh
74-
7577
* After building, you'll find the output in the `$DM_DEBUG_JOB_FOLDER/build` folder
7678

7779
* Set up the debugger to point to the executable
7880

7981
* Set the working dir to the project directory
8082

81-
## Login
82-
83-
After building your Docker container, you can login in using the script:
84-
85-
$ ./server/scripts/debug-local.sh
86-
87-
or
88-
89-
> server\scripts\debug-local.bat
90-
91-
Make sure you are `extender` by typing
92-
93-
$ whoami
94-
extender
95-
96-
9783
## Win32
9884

9985
Wine needs the WINEPATH to be set. Like so (taken from the sdk's build.yml):

0 commit comments

Comments
 (0)