Skip to content

Commit eb925c0

Browse files
committed
feat: push existing service with empty docs
1 parent 3339886 commit eb925c0

16 files changed

Lines changed: 540 additions & 1 deletion

File tree

.devcontainer/Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Use Ubuntu 22.04 as the base image
2+
FROM ubuntu:22.04
3+
4+
# Set environment variables to prevent interactive prompts during package installation
5+
ARG DEBIAN_FRONTEND=noninteractive
6+
7+
# Update package list and install necessary tools and dependencies
8+
RUN apt-get update && \
9+
apt-get install -y \
10+
git \
11+
curl \
12+
gnupg \
13+
make \
14+
build-essential \
15+
pkg-config \
16+
libzmq3-dev \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
# Install Go 1.21 based on the system architecture
20+
RUN ARCH=$(dpkg --print-architecture) && \
21+
if [ "$ARCH" = "amd64" ]; then \
22+
GO_ARCH="go1.21.0.linux-amd64.tar.gz"; \
23+
elif [ "$ARCH" = "arm64" ]; then \
24+
GO_ARCH="go1.21.0.linux-arm64.tar.gz"; \
25+
else \
26+
echo "Unsupported architecture"; exit 1; \
27+
fi && \
28+
curl -fsSL "https://go.dev/dl/$GO_ARCH" -o "$GO_ARCH" && \
29+
tar -C /usr/local -xzf "$GO_ARCH" && \
30+
rm "$GO_ARCH" && \
31+
# Install Go language server
32+
/usr/local/go/bin/go install golang.org/x/tools/gopls@latest
33+
34+
# Install golangci-lint
35+
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.54.2
36+
37+
# Create a non-root user with a home directory and bash as default shell
38+
ARG USERNAME=devuser
39+
ARG USER_UID=1000
40+
ARG USER_GID=$USER_UID
41+
42+
RUN groupadd --gid $USER_GID $USERNAME \
43+
&& useradd --uid $USER_UID --gid $USER_GID -m -s /bin/bash $USERNAME \
44+
&& apt-get update && apt-get install -y sudo \
45+
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
46+
&& chmod 0440 /etc/sudoers.d/$USERNAME
47+
48+
# Copy skeleton files to set up the user's shell environment
49+
RUN cp /etc/skel/.bashrc /home/$USERNAME/.bashrc \
50+
&& cp /etc/skel/.profile /home/$USERNAME/.profile \
51+
&& chown -R $USERNAME:$USERNAME /home/$USERNAME
52+
53+
# Switch to the new user
54+
USER $USERNAME
55+
56+
# Set the working directory
57+
WORKDIR /home/$USERNAME
58+
# Set up Go environment variables
59+
ENV PATH="/usr/local/go/bin:/usr/local/bin:${PATH}"
60+
61+
# Ensure CGO is enabled for the zmq4 package
62+
ENV CGO_ENABLED=1
63+
64+
# Set the CGO CFLAGS and LDFLAGS for the zmq4 library
65+
ENV CGO_CFLAGS_ALLOW="-std=gnu99"
66+
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
67+

.devcontainer/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ASE-service",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"streetsidesoftware.code-spell-checker",
10+
"golang.go", // Go language server extension
11+
"golangci.golangci-lint", // golangci-lint extension
12+
"ms-vscode.makefile-tools", // Makefile Tools extension
13+
"dbankier.vscode-quick-select" // Quick select with cmd/ctrl+k "
14+
]
15+
}
16+
},
17+
"capAdd": [
18+
"SYS_PTRACE"
19+
],
20+
"securityOpt": [
21+
"seccomp=unconfined"
22+
],
23+
"forwardPorts": []
24+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: build-and-upload
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
build-and-upload:
13+
uses: VU-ASE/actions/.github/workflows/build-and-upload.yaml@main
14+
secrets:
15+
gh_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release:
14+
uses: VU-ASE/actions/.github/workflows/release.yaml@main
15+
secrets:
16+
release_please_token: ${{ secrets.RELEASE_PLEASE_TOKEN }}

.github/workflows/test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: test
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
pull-requests: read # Optional: Use with `only-new-issues` option.
9+
10+
jobs:
11+
test:
12+
uses: VU-ASE/actions/.github/workflows/test.yaml@main
13+
secrets:
14+
gh_pat: ${{ secrets.GH_PAT }}

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool, specifically when used with LiteIDE
15+
*.out
16+
17+
# Dependency directories (remove the comment below to include it)
18+
# vendor/
19+
20+
# Go workspace file
21+
go.work
22+
23+
# Build outputs
24+
bin

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Changelog
2+
3+
## [1.1.0](https://github.com/VU-ASE/service-template-go/compare/v1.0.0...v1.1.0) (2025-03-29)
4+
5+
6+
### Features
7+
8+
* align templates and make example controller ([c8a5030](https://github.com/VU-ASE/service-template-go/commit/c8a5030b431c3241af42db10fb9696ae7f34d782))
9+
* compliant with roverctl and roverd design ([5499431](https://github.com/VU-ASE/service-template-go/commit/5499431275cbbd83e9c9bddc1872e7dde09de414))
10+
11+
12+
### Bug Fixes
13+
14+
* change log print to float ([190a417](https://github.com/VU-ASE/service-template-go/commit/190a417c23b9f208532b2113de116fdb3929d9a1))
15+
* linting step not part of build and test ([edd6c22](https://github.com/VU-ASE/service-template-go/commit/edd6c226d6c99856a270272f0fa2088b3eeea131))
16+
* make service version dynamic for use with roverctl ([a6ccb99](https://github.com/VU-ASE/service-template-go/commit/a6ccb996d4575dd4be34edfef4bd3f5d2a945937))
17+
* missing array check on incoming trajectory points ([7ee70ac](https://github.com/VU-ASE/service-template-go/commit/7ee70ac9541f562d24562d0888d8b225624686ec))
18+
* rename, always use .yaml ([0f3bb46](https://github.com/VU-ASE/service-template-go/commit/0f3bb464191fd3232a8abfe384e3449c82c398f3))
19+
* updated rovercom and roverlib-go ([08bad1b](https://github.com/VU-ASE/service-template-go/commit/08bad1bba18344d08e7b4787fee51180d25a04a4))
20+
* updated to use reusable actions ([b1f8c52](https://github.com/VU-ASE/service-template-go/commit/b1f8c525ac8237ff3af2f703e67a9e0b825b1a4e))
21+
* upgraded deps ([4d975f9](https://github.com/VU-ASE/service-template-go/commit/4d975f99af27b1223e2e90e31878651de055245c))
22+
* version bumped deps ([ea33026](https://github.com/VU-ASE/service-template-go/commit/ea3302671bf635648c98094255ce7700bde96661))

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 VU Autonomous Systems Engineering
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Makefile in accordance with the docs on git management (to use in combination with meta)
2+
.PHONY: build start clean test
3+
4+
BUILD_DIR=bin/
5+
BINARY_NAME=rpm-service
6+
7+
lint:
8+
@echo "Lint check..."
9+
@golangci-lint run
10+
11+
build: #lint
12+
@echo "building ${BINARY_NAME}"
13+
@cd src/ && go build -o "../$(BUILD_DIR)${BINARY_NAME}" ${buildargs}
14+
15+
#
16+
# You can specify run arguments and build arguments using runargs and buildargs, like this:
17+
# make start runargs="-debug"
18+
# make start runargs="-debug" buildargs="-verbose"
19+
# make build buildargs="-verbose"
20+
#
21+
start: build
22+
@echo "starting ${BINARY_NAME}"
23+
./${BUILD_DIR}${BINARY_NAME} ${runargs}
24+
25+
clean:
26+
@echo "Cleaning all targets for ${BINARY_NAME}"
27+
rm -rf $(BUILD_DIR)
28+
29+
test: lint
30+
go test ./src -v -count=1 -timeout 0

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
# rpm
1+
<h1 align="center">service template for <code>go</code></h1>
2+
<div align="center">
3+
<a href="https://github.com/VU-ASE/service-template-go/releases/latest">Latest release</a>
4+
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
5+
<a href="https://ase.vu.nl/docs/framework/glossary/service">About a service</a>
6+
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
7+
<a href="https://ase.vu.nl/docs/framework/glossary/roverlib">About the roverlib</a>
8+
<br />
9+
</div>
10+
<br/>
11+
12+
**When building a service that runs on the Rover and should interface the ASE framework, you will most likely want to use a [roverlib](https://ase.vu.nl/docs/framework/glossary/roverlib). This is a Go template that incorporates [`roverlib-go`](https://github.com/VU-ASE/roverlib-go), meant to run on the Rover.**
13+
14+
## Initialize a Go service
15+
16+
Instead of cloning this repository, it is recommended to initialize this Go service using `roverctl` as follows:
17+
18+
```bash
19+
roverctl service init go --name go-example --source github.com/author/go-example
20+
```
21+
22+
Read more about using `roverctl` to initialize services [here](https://ase.vu.nl/docs/framework/Software/rover/roverctl/usage#initialize-a-service).
23+
24+

0 commit comments

Comments
 (0)