Skip to content

Commit

Permalink
switch from theia to code-server
Browse files Browse the repository at this point in the history
  • Loading branch information
yosuke committed Nov 16, 2023
1 parent 0d6a1f5 commit 5b8ee0a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 90 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/code-server.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[program:code-server]
command=code serve-web --host 0.0.0.0 --port 3000 --without-connection-token --accept-server-license-terms
autostart=true
autorestart=true
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=developer
directory=/home/developer
environment=HOME=/home/developer,ROS_DISTRO=%(ENV_ROS_DISTRO)s
61 changes: 0 additions & 61 deletions .devcontainer/theia-latest.package.json

This file was deleted.

11 changes: 0 additions & 11 deletions .devcontainer/theia.conf

This file was deleted.

6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"workbench.colorTheme": "Monokai",
"fileTemplates.templates_dir": "/home/developer/templates",
"files.associations": {
"*.launch": "xml",
Expand Down Expand Up @@ -41,6 +42,7 @@
],
"C_Cpp.intelliSenseCacheSize": 0,
"C_Cpp.intelliSenseEngine": "Tag Parser",
"python.pythonPath": "/usr/bin/python",
"python.showStartPage": false
"python.analysis.extraPaths": [
"/opt/ros/noetic/lib/python3/dist-packages"
]
}
25 changes: 14 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ RUN sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb
RUN sh -c 'echo "deb https://deb.nodesource.com/node_14.x `lsb_release -cs` main" > /etc/apt/sources.list.d/nodesource.list' && \
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -

# vscode
RUN curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \
install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg && \
sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' 88 \
rm -f packages.microsoft.gpg

# install depending packages
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y bash-completion less wget vim-tiny iputils-ping net-tools openssh-client git openjdk-8-jdk-headless nodejs sudo imagemagick byzanz python-dev libsecret-1-dev && \
apt-get install -y bash-completion less wget language-pack-en code vim-tiny iputils-ping net-tools openssh-client git openjdk-8-jdk-headless nodejs sudo imagemagick byzanz python-dev libsecret-1-dev && \
npm install -g yarn && \
apt-get clean

Expand All @@ -82,7 +88,7 @@ RUN useradd -m developer && \

# install depending packages (install moveit! algorithms on the workspace side, since moveit-commander loads it from the workspace)
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y ros-$ROS_DISTRO-desktop ros-$ROS_DISTRO-moveit ros-$ROS_DISTRO-moveit-commander ros-$ROS_DISTRO-moveit-ros-visualization ros-$ROS_DISTRO-trac-ik ros-$ROS_DISTRO-move-base-msgs ros-$ROS_DISTRO-ros-numpy && \
apt-get install -y ros-$ROS_DISTRO-desktop ros-$ROS_DISTRO-gazebo-msgs ros-$ROS_DISTRO-moveit ros-$ROS_DISTRO-moveit-commander ros-$ROS_DISTRO-moveit-ros-visualization ros-$ROS_DISTRO-trac-ik ros-$ROS_DISTRO-move-base-msgs ros-$ROS_DISTRO-ros-numpy && \
apt-get clean

# install bio_ik
Expand All @@ -98,7 +104,7 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
# configure services
RUN mkdir -p /etc/supervisor/conf.d
COPY .devcontainer/supervisord.conf /etc/supervisor/supervisord.conf
COPY .devcontainer/theia.conf /etc/supervisor/conf.d/theia.conf
COPY .devcontainer/code-server.conf /etc/supervisor/conf.d/code-server.conf
COPY .devcontainer/jupyter.conf /etc/supervisor/conf.d/jupyter.conf

COPY .devcontainer/entrypoint.sh /entrypoint.sh
Expand Down Expand Up @@ -140,18 +146,15 @@ RUN rosdep update

# global vscode config
ADD .vscode /home/developer/.vscode
ADD .vscode /home/developer/.theia
ADD .vscode /home/developer/.vscode-server
ADD .devcontainer/compile_flags.txt /home/developer/compile_flags.txt
ADD .devcontainer/templates /home/developer/templates
RUN sudo chown -R developer:developer /home/developer

# install theia web IDE
COPY .devcontainer/theia-latest.package.json /home/developer/package.json
RUN yarn --cache-folder ./ycache && rm -rf ./ycache && \
NODE_OPTIONS="--max_old_space_size=4096" yarn theia build && \
yarn theia download:plugins

ENV THEIA_DEFAULT_PLUGINS local-dir:/home/developer/plugins
RUN code --install-extension ms-vscode.cpptools-extension-pack && \
code --install-extension ms-python.python && \
code --install-extension redhat.vscode-xml && \
cp -r /home/developer/.vscode/extensions /home/developer/.vscode-server/extensions

# enable jupyter extensions
RUN jupyter nbextension enable hinterland/hinterland && \
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Packed with:
- Tasks definition to run catkin_make, roscore, rviz commands.
- Preconfigured code completion for C++, Python, XML (package.xml, launchfiles, URDF, SDF).
- Preconfigured simulation environments (Flatland, TurtleBot3, ARIAC, Virtual RobotX, UUV).
- Bonus: WebIDE (Theia) with preconfigured C++, Python, XML completion.
- Bonus: WebIDE (code-server) with preconfigured C++, Python, XML completion.

VSCode and devcontainer running on Mac:
![screenshot](https://user-images.githubusercontent.com/18067/58605055-8dc84980-82d1-11e9-8ee5-dc969fcb2ae1.png)

WebIDE (Theia) opened from the local browser while devcontainer is running on the remote server:
WebIDE opened from the local browser while devcontainer is running on the remote server:
![screenshot-theia](https://user-images.githubusercontent.com/18067/59972289-58a8d180-95c7-11e9-86fd-7d271684e8b3.PNG)

How to select simulation environment
Expand All @@ -36,7 +36,7 @@ https://github.com/devrt/simulator-index/issues
How to use the WebIDE (recommended)
-------------------------------------
As of writing, docker-compose support of VSCode is not so stable on all the platforms.
We recommend using Theia WebIDE since it has complete VSCode function support after 1.0 release.
We recommend using code-server WebIDE since it has complete VSCode function support.

1. Clone this repository:
```shell
Expand Down Expand Up @@ -140,5 +140,4 @@ License
Code in this repository (Dockerfile, utility scripts, etc) is distributed under Apache 2.0 license.

Included components are distributed under each different licenses:
- Theia IDE: EPL or GPL
- Jupyter notebook: BSD
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ services:
- "3002:8888"
volumes:
- workspace:/workspace
- ~/.gitconfig:/home/developer/.gitconfig
environment:
- DISPLAY=:0
- ROS_MASTER_URI=http://simulator:11311/
Expand Down

0 comments on commit 5b8ee0a

Please sign in to comment.