Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use Task #1535

Merged
merged 22 commits into from
Apr 17, 2024
Merged

build: use Task #1535

merged 22 commits into from
Apr 17, 2024

Conversation

fortuna
Copy link
Collaborator

@fortuna fortuna commented Apr 16, 2024

We now build outline-ss-server directly and cross-compile the docker image.

@fortuna fortuna requested a review from a team as a code owner April 16, 2024 07:10
Copy link
Contributor

@sbruens sbruens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you get rid of scripts/run_action.sh now?

README.md Outdated
@@ -41,7 +41,7 @@ See [Shadowsocks resistance against detection and blocking](docs/shadowsocks.md)
1. **Start the server**

```sh
npm run action shadowbox/server/start
task shadowbox:server:start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Task as a prerequisite above for easy setup instructions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to mention Go as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Go. The task binary is now built on npm install

```

- **Docker Container**

```sh
npm run action shadowbox/docker/start
task shadowbox:docker:start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task doesn't exist. You only specified docker:build. Can you create one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I forgot about it. I'll work on it.

# Copy entrypoint command
- cp '{{joinPath .TASKFILE_DIR "docker/cmd.sh"}}' '{{.IMAGE_ROOT}}/'
# Build image with given root
- podman build --force-rm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, this will be surprising to most users - Docker is still exponentially more popular. A user trying to run the server will run task shadowbox:docker:build thinking they're building an image using their Docker installation, and it fails on a missing podman installation, which isn't mentioned anywhere. If nothing else, update the README to replace Docker with Podman.

However, as many users will have Docker installed already, an additional installation could just put them off trying out the instructions to play with the server. Maybe we can explicitly create a shadowbox:podman:build or check if podman exists and fallback to Docker if not.

PS: I'm not arguing that Docker is better than Podman (it's not), I'm just hoping to keep the on-ramp for new users easy and predictable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. It was for testing, I didn't actually intend to change. I've reverted to docker, but have an option to override. I can now do ./task shadowbox:docker:build DOCKER=podman

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, the override is cool.

Copy link
Contributor

@jyyi1 jyyi1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool. Maybe we can support building from Windows once we migrate to a cross-platform build pipeline in the future.

```
- Integration test
```sh
npm run action metrics_server/test_integration
task metrics_server:integration:test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit shall we rename it to integration_test? Cuz we don't have other sub-tasks for integration?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. That aligns with shadowbox too. Renamed

deps: [build]
cmds:
- cp '{{.TASKFILE_DIR}}/config_dev.json' '{{.SERVER_DIR}}/config.json'
- npx node '{{.SERVER_DIR}}/index.js'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need npx here? Can we just use node {{.SERVER_DIR}}/index.js?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

README.md Outdated
@@ -41,7 +41,7 @@ See [Shadowsocks resistance against detection and blocking](docs/shadowsocks.md)
1. **Start the server**

```sh
npm run action shadowbox/server/start
task shadowbox:server:start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to mention Go as well.

TARGET_OS: '{{.TARGET_OS | default "linux"}}'
TARGET_ARCH: '{{.TARGET_ARCH | default "x86_64"}}'
GOOS: '{{get (dict "macos" "darwin") .TARGET_OS | default .TARGET_OS}}'
GOARCH: '{{get (dict "x86_64" "arm64") .TARGET_ARCH | default .TARGET_ARCH}}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GOARCH: '{{get (dict "x86_64" "arm64") .TARGET_ARCH | default .TARGET_ARCH}}'
GOARCH: '{{get (dict "x86_64" "amd64") .TARGET_ARCH | default .TARGET_ARCH}}'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@fortuna fortuna requested review from jyyi1 and sbruens April 17, 2024 14:38
Copy link
Contributor

@sbruens sbruens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but please don't forget to add the docker:start task.

Copy link
Contributor

@jyyi1 jyyi1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM, please make sure the CI job passes.

Taskfile.yml Outdated
clean:
desc: Clean output files
cmds:
- rm -rf .task src/*/node_modules/ build/ node_modules/ third_party/shellcheck/download/ third_party/*/bin third_party/jsign/*.jar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to remove the ./task binary built by npm install as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Done

@fortuna
Copy link
Collaborator Author

fortuna commented Apr 17, 2024

docker:start added. It was a pain to make it work. Ran into cross-compilation issues...

@fortuna fortuna merged commit 6556d7e into master Apr 17, 2024
10 checks passed
@fortuna fortuna deleted the fortuna-task branch April 17, 2024 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants