Skip to content

Commit

Permalink
Merge pull request containers#207 from cfergeau/podmanstuff
Browse files Browse the repository at this point in the history
Improvements to the systemd unit file
  • Loading branch information
openshift-merge-robot authored Apr 25, 2023
2 parents 64db3a3 + 79e078b commit ee06501
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ qemu-wrapper:

.PHONY: vm
vm:
GOOS=linux CGO_ENABLED=0 go build $(LDFLAGS) -o bin/vm ./cmd/vm
GOOS=linux CGO_ENABLED=0 go build $(LDFLAGS) -o bin/gvforwarder ./cmd/vm

# win-sshproxy is compiled as a windows GUI to support backgrounding
.PHONY: win-sshproxy
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ With a container:

With the executable:
```
(vm) # ./vm -debug
(vm) # ./gvforwarder -debug
```

## Services
Expand Down
13 changes: 13 additions & 0 deletions contrib/systemd/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=gvisor-tap-vsock Network Traffic Forwarder
After=NetworkManager.service
BindsTo=sys-devices-virtual-net-%i.device
After=sys-devices-virtual-net-%i.device

[Service]
Environment=GV_VSOCK_PORT="1024"
EnvironmentFile=-/etc/sysconfig/gv-user-network
ExecStart=/usr/libexec/podman/gvforwarder -preexisting -iface %i -url vsock://2:${GV_VSOCK_PORT}/connect

[Install]
WantedBy=multi-user.target
12 changes: 0 additions & 12 deletions contrib/systemd/user-network.service

This file was deleted.

19 changes: 16 additions & 3 deletions gvisor-tap-vsock.spec.rpkg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Source: {{{ git_dir_pack }}}
BuildRequires: gcc
BuildRequires: golang >= 1.16.6
BuildRequires: git-core
BuildRequires: systemd-rpm-macros
%if 0%{?fedora} || 0%{?rhel} >= 9
BuildRequires: go-rpm-macros
%endif
Expand Down Expand Up @@ -71,17 +72,29 @@ ln -s vendor src

export GOPATH=$(pwd)/_build:$(pwd)
%gobuild -o bin/gvproxy ./cmd/gvproxy
%gobuild -o bin/vm ./cmd/vm
%gobuild -o bin/gvforwarder ./cmd/vm

%install
install -dp %{buildroot}%{_libexecdir}/podman
install -p -m0755 bin/gvproxy %{buildroot}%{_libexecdir}/podman
install -p -m0755 bin/vm %{buildroot}%{_libexecdir}/podman
install -p -m0755 bin/gvforwarder %{buildroot}%{_libexecdir}/podman
install -dp %{buildroot}%{_unitdir}
install -p -m0644 contrib/systemd/[email protected] %{buildroot}%{_unitdir}

%post
%systemd_post [email protected]

%preun
%systemd_preun [email protected]

%postun
%systemd_postun_with_restart [email protected]

%files
%dir %{_libexecdir}/podman
%{_libexecdir}/podman/gvproxy
%{_libexecdir}/podman/vm
%{_libexecdir}/podman/gvforwarder
%{_unitdir}/[email protected]

%changelog
{{{ git_dir_changelog }}}
4 changes: 2 additions & 2 deletions images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ RUN make
FROM busybox
COPY images/udhcpc.sh /usr/share/udhcpc/default.script
RUN chmod +x /usr/share/udhcpc/default.script
COPY --from=build /opt/app-root/src/bin/vm .
ENTRYPOINT ["/vm"]
COPY --from=build /opt/app-root/src/bin/gvforwarder .
ENTRYPOINT ["/gvforwarder"]
2 changes: 1 addition & 1 deletion test/wsl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -x

./bin/vm \
./bin/gvforwarder \
-url="stdio:$(pwd)/bin/gvproxy-windows.exe?listen-stdio=accept&debug=true" \
-iface="eth1" \
-stop-if-exist="" \
Expand Down

0 comments on commit ee06501

Please sign in to comment.