Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
- Created GitHub workflow and Dockerfile to automatically build Docker images
- Update to Ubuntu 22.04 and Python 3.10 for prerequisites image
- Update to Ubuntu 22.04 and Python 3.10 for release image
- Created vulkan-base Dockerfile to replace discontinued nvidia/vulkan images used for the release image
- Added health check to release image

- Added `ping.py` script to PythonAPI to enable health checks
- Fix [aria2](https://aria2.github.io/) related issue
- Fix fbx sdk download by using `curl` instead of `wget`
  • Loading branch information
cgeller authored Jan 31, 2024
1 parent d7b45c1 commit 691f170
Show file tree
Hide file tree
Showing 10 changed files with 405 additions and 34 deletions.
165 changes: 165 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Docker

on: [push, pull_request]

jobs:

# set up
clean-up:
name: Clean up
runs-on: self-hosted
steps:

- name: Clean up
run: rm -rf *

# create carla-prerequisites image
create-carla-prerequisites-image:
name: Create carla-prerequisites image
runs-on: self-hosted
needs: clean-up
steps:

- uses: docker/build-push-action@v5
name: Build image
with:
file: Util/Docker/Prerequisites.Dockerfile
tags: carla-prerequisites
no-cache: true
build-args: |
EPIC_USER=${{ secrets.EPIC_USER }}
EPIC_PASS=${{ secrets.EPIC_PASS }}
# create and push carla-source image
create-carla-source-image:
name: Create carla-source image
runs-on: self-hosted
needs: create-carla-prerequisites-image
env:
IMAGE_TAG_SUFFIX: ""

steps:

- name: Set image tag
run: |
echo "IMAGE_TAG_SUFFIX=_$(echo '${{ github.ref_name }}' | tr / -)_ci" >> $GITHUB_ENV
if: github.ref.name != github.event.repository.default_branch

- uses: actions/checkout@v3
name: Checkout repository
with:
submodules: true

- uses: docker/login-action@v3
name: Login to Docker Hub
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: docker/build-push-action@v5
name: Build and push image
with:
file: Util/Docker/Carla.Dockerfile
tags: rwthika/carla-simulator:source${{env.IMAGE_TAG_SUFFIX}}
no-cache: true
push: false
context: .

# provide artifacts and releases
provide-artifacts:
name: Provide carla artifacts
runs-on: self-hosted
needs: create-carla-source-image
env:
IMAGE_TAG_SUFFIX: ""

steps:

- name: Set image tag
run: |
echo "IMAGE_TAG_SUFFIX=_$(echo '${{ github.ref_name }}' | tr / -)_ci" >> $GITHUB_ENV
if: github.ref.name != github.event.repository.default_branch

# provide carla-package
- uses: shrink/actions-docker-extract@v3
name: Extract carla-package
with:
image: rwthika/carla-simulator:source${{env.IMAGE_TAG_SUFFIX}}
path: home/carla/carla/Dist
destination: artifacts/

# provide carla-python-api
- uses: shrink/actions-docker-extract@v3
name: Extract carla-python-api
id: extract_python_api
with:
image: rwthika/carla-simulator:source${{env.IMAGE_TAG_SUFFIX}}
path: home/carla/carla/PythonAPI
destination: artifacts/

# create archive for release
- name: Create archive
if: startsWith(github.ref, 'refs/tags')
run: tar -czvf artifacts/PythonAPI.tar.gz artifacts/PythonAPI

# provide release
- uses: ncipollo/release-action@v1
name: Create Release
if: startsWith(github.ref, 'refs/tags')
with:
allowUpdates: true
tag: ${{ github.ref_name }}
commit: ${{ github.sha }}
artifacts: artifacts/PythonAPI.tar.gz
token: ${{ secrets.PAT }}

# create vulkan-base for carla release
create-vulkan-base-image:
name: Create vulkan-base image
runs-on: self-hosted
needs: provide-artifacts
steps:

- uses: docker/build-push-action@v5
name: Build image
with:
file: Util/Docker/vulkan-base/Vulkan.Dockerfile
tags: vulkan-base
no-cache: true
build-args: |
BASE_DIST=ubuntu22.04
CUDA_VERSION=12.2.0
context: Util/Docker/vulkan-base

# create and push carla image
create-carla-image:
name: Create carla image
runs-on: self-hosted
needs: create-vulkan-base-image
env:
IMAGE_TAG_SUFFIX: ""

steps:

- name: Set image tag
run: |
echo "IMAGE_TAG_SUFFIX=_$(echo '${{ github.ref_name }}' | tr / -)_ci" >> $GITHUB_ENV
if: github.ref.name != github.event.repository.default_branch

- uses: docker/login-action@v3
name: Login to Docker Hub
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract artifact
run: mkdir -p build && tar -xvzf artifacts/Dist/*.tar.gz -C build

- uses: docker/build-push-action@v5
name: Build and push
with:
file: build/Dockerfile
tags: rwthika/carla-simulator:latest${{env.IMAGE_TAG_SUFFIX}}
no-cache: true
context: build
push: true
17 changes: 17 additions & 0 deletions CARLOS_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Latest : 1.0.0

## 1.0.0 - Initial Release

### Major changes

* Created GitHub workflow and Dockerfile to automatically build Docker images
* Update to Ubuntu 22.04 and Python 3.10 for prerequisites image
* Update to Ubuntu 22.04 and Python 3.10 for release image
* Created `vulkan-base` Dockerfile to replace discontinued `nvidia/vulkan` images used for the release image
* Added health check to release image

### Minor changes

* Added `ping.py` script to PythonAPI to enable health checks
* Fix [aria2](https://aria2.github.io/) related issue
* Fix fbx sdk download by using `curl` instead of `wget`
70 changes: 70 additions & 0 deletions PythonAPI/util/ping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env python

# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.

"""Performs a single connection check to the simulator."""

import glob
import os
import sys

try:
os.chdir(os.path.dirname(__file__))
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
except IndexError:
pass


import carla

import argparse


def main():
argparser = argparse.ArgumentParser(
description=__doc__)
argparser.add_argument(
'--host',
metavar='H',
default='127.0.0.1',
help='IP of the host server (default: 127.0.0.1)')
argparser.add_argument(
'-p', '--port',
metavar='P',
default=2000,
type=int,
help='TCP port to listen to (default: 2000)')
argparser.add_argument(
'--timeout',
metavar='T',
default=1.0,
type=float,
help='time-out in seconds (default: 1)')
args = argparser.parse_args()

try:
client = carla.Client(args.host, args.port)
except RuntimeError:
print('IP/Hostname %s could not be resolved' % (args.host))
return 1

client.set_timeout(args.timeout)

try:
print('CARLA %s connected at %s:%d.' % (client.get_server_version(), args.host, args.port))
return 0
except RuntimeError:
print('Failed to connect to %s:%d before time-out of %d second(s).' % (args.host, args.port, args.timeout))
return 1


if __name__ == '__main__':

sys.exit(main())
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
CARLA Simulator
===============
# Simulation Core: *carla-simulator*

<p align="left">
<img src="https://img.shields.io/github/v/release/ika-rwth-aachen/carla-simulator"/>
<img src="https://img.shields.io/github/license/ika-rwth-aachen/carla-simulator"/>
<a href="https://github.com/ika-rwth-aachen/carla-simulator/actions/workflows/docker.yml">
<img src="https://github.com/ika-rwth-aachen/carla-simulator/actions/workflows/docker.yml/badge.svg"/></a>
<img src="https://img.shields.io/badge/CARLA-0.9.15-blueviolet"/>
<img src="https://img.shields.io/badge/Python-3.10-blueviolet"/>
<img src="https://img.shields.io/github/stars/ika-rwth-aachen/carla-simulator?style=social"/>
</p>

> [!IMPORTANT]
> This repository is a minimal fork of the official [carla-simulator](https://github.com/carla-simulator/carla)! All modifications to the original repository are documented in [CARLOS_CHANGELOG.md](./CARLOS_CHANGELOG.md).
> [!TIP]
> We recommend to use the *carla-simulator* as **simulation core** in our open, modular and scalable simulation framework <a href="https://github.com/ika-rwth-aachen/carlos">**CARLOS**. <img src="https://img.shields.io/github/stars/ika-rwth-aachen/carlos?style=social"/></a>
>
> Here, it constitutes the central element of a simulation and handles all graphical and dynamic calculations in the individual simulation time steps.
> [!NOTE]
> We set up a Continous Integration (CI) pipeline as [GitHub workflow](./github/workflows/docker.yml) to continously build Docker images for the `carla-simulator`, publicly available on [Docker Hub](https://hub.docker.com/r/rwthika/carla-simulator).
---
---
## Original README

[![Build Status](https://travis-ci.org/carla-simulator/carla.svg?branch=master)](https://travis-ci.org/carla-simulator/carla)
[![Documentation](https://readthedocs.org/projects/carla/badge/?version=latest)](http://carla.readthedocs.io)
Expand Down
14 changes: 8 additions & 6 deletions Update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ function download_content {
fi
mkdir -p "$CONTENT_FOLDER"
mkdir -p Content
if hash aria2c 2>/dev/null; then
echo -e "${CONTENT_LINK}\n\tout=Content.tar.gz" > .aria2c.input
aria2c -j16 -x16 --input-file=.aria2c.input
rm -f .aria2c.input
else

#if hash aria2c 2>/dev/null; then
# echo -e "${CONTENT_LINK}\n\tout=Content.tar.gz" > .aria2c.input
# aria2c -j16 -x16 --input-file=.aria2c.input
# rm -f .aria2c.input
#else
wget -c ${CONTENT_LINK} -O Content.tar.gz
fi
#fi

tar -xvzf Content.tar.gz -C Content
rm Content.tar.gz
mv Content/* "$CONTENT_FOLDER"
Expand Down
2 changes: 1 addition & 1 deletion Util/BuildTools/BuildUtilsDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FBXSDK_URL=https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-0-1/${

if [ ! -d "${FBX2OBJ_DEP_FOLDER}" ]; then
log "Downloading FBX SDK..."
wget -c "${FBXSDK_URL}" -P "${CARLA_DOCKER_UTILS_FOLDER}" --user-agent="Mozilla"
curl -L "${FBXSDK_URL}" -o "${CARLA_DOCKER_UTILS_FOLDER}/${LIB_NAME}.tar.gz" --user-agent "Mozilla"

echo "Unpacking..."
mkdir -p "${FBX2OBJ_DEP_FOLDER}"
Expand Down
20 changes: 9 additions & 11 deletions Util/Docker/Carla.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ FROM carla-prerequisites:latest
ARG GIT_BRANCH

USER carla
WORKDIR /home/carla

RUN cd /home/carla/ && \
if [ -z ${GIT_BRANCH+x} ]; then git clone --depth 1 https://github.com/carla-simulator/carla.git; \
else git clone --depth 1 --branch $GIT_BRANCH https://github.com/carla-simulator/carla.git; fi && \
cd /home/carla/carla && \
./Update.sh && \
make CarlaUE4Editor && \
make PythonAPI && \
make build.utils && \
make package && \
rm -r /home/carla/carla/Dist
COPY --chown=carla . /home/carla/carla

WORKDIR /home/carla/carla

RUN pip3 install -Iv setuptools==47.3.1

RUN ./Update.sh
RUN make CarlaUE4Editor
RUN make PythonAPI ARGS="--python-version='3.10'"
RUN make build.utils
RUN make package ARGS="--clean-intermediate"
Loading

0 comments on commit 691f170

Please sign in to comment.