-
Notifications
You must be signed in to change notification settings - Fork 645
Add additional documentation #8
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
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fc0a12a
Create configuring_environment.md
46b0ef4
Change start dir to default code-server start dir
5afd7a9
Fix spelling
f8a0b6e
Add files via upload
3b71e7b
Update configuring_environment.md
e75424c
Fix formatting
4108ab6
Update configuring_environment.md
77efbf4
Fix formatting
52b7859
Fix formatting yet again
9b90f82
Add files via upload
c36342c
Update configuring_environment.md
c66c76e
Fix spelling
227f5c8
Add link to additional documentation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
# Configure code-server and environemnt | ||
### Changing START_DIR in [entrypoint.sh](/deploy-container/entrypoint.sh) or getting Directory '/home/coder/poject' does not exist | ||
If you change the directory and now code-server wont work, or if you are getting errors containg the starting directory that say it doesnt exist, you can add the following command into the Dockerfile to create the starting directory | ||
```Dockerfile | ||
# Create starting directory | ||
# Should be the same as $START_DIR in entrypoint.sh | ||
RUN mkdir /home/coder/project | ||
``` | ||
___ | ||
### Using a config.yaml file for code-server | ||
code-server will automatically generate a configuration file [[Source]](https://github.com/cdr/code-server/blob/main/docs/FAQ.md#how-does-the-config-file-work)<br> | ||
You can create a config.yaml file in the deploy-container directory containing your code-server configuration.<br> | ||
Afterwards, in order for it to be used, you will need to add these Docker commands to the Dockerfile | ||
```Dockerfile | ||
# Create config directory | ||
RUN mkdir /home/coder/.config | ||
|
||
# Copy config file | ||
# The path to the file bing copied should be the same as where you created the config file | ||
COPY deploy-container/config.yaml /home/coder/.config/code-server/config.yaml | ||
``` | ||
Now you can edit entrypoint.sh and change the last line to | ||
```shell | ||
# Now we can run code-server with the default entrypoint | ||
# The path to the config file should be where it was copied to | ||
/usr/bin/entrypoint.sh --config /home/coder/.config/code-server/config.yaml --bind-addr 0.0.0.0:8080 $START_DIR | ||
``` | ||
Or you can set the CODE_SERVER_CONFIG environment variable to the path of your configuration file<br> | ||
For more information about this, see [cdr/code-server/main/docs/FAQ.md](https://github.com/cdr/code-server/blob/main/docs/FAQ.md#how-does-the-config-file-work) | ||
___ | ||
### Changing the default vscode settings that get applied each time the container is rebuilt | ||
You can simply edit deploy-container/settings.json to your vscode settings. When the container gets rebuilt, they will be copied to the appropriate place and be applied in code-server.<br> | ||
> NOTE: These settings are applied User-wide | ||
___ | ||
### directory '/home/coder/.config/rclone' does not exist | ||
If you are getting this error, you can add this command to your Dockerfile | ||
```Dockerfile | ||
# Create rclone config directory | ||
RUN mkdir /home/coder/.config/rclone | ||
``` | ||
If you are getting "directory '/home/coder/.config' does not exist", see above for how to create the .config directory or add the -p flag to create any non-existant parent directories as well | ||
___ | ||
### Installing extensions | ||
> NOTE: not all extensions maybe available in code-server, see [[1]](https://github.com/cdr/code-server/blob/main/docs/FAQ.md#differences-compared-to-vs-code), [[2]](https://github.com/cdr/code-server/blob/main/docs/FAQ.md#how-can-i-request-a-missing-extension), [[3]](https://github.com/cdr/code-server/blob/main/docs/FAQ.md#how-do-i-configure-the-marketplace-url), and [[4]](https://github.com/cdr/code-server/blob/main/docs/FAQ.md#where-are-extensions-stored) for more info | ||
|
||
There are several ways to install extensions | ||
1. Installing directly in code-server<br> | ||
You can install extensions directly from inside code-server using the GUI. The button should be in the activity bar on the left and looks like this | ||
<br> | ||
You can also use Ctrl+Shift+X to bring it up | ||
> NOTE: Extensions installed using this method will not persist between container rebuilds | ||
|
||
2. Installing using vscode integrated terminal<br> | ||
You can install extensions by using the built-in terminal in code-server. Use Ctrl+J to bring up the panel and select the terminal tab. Or you can use Ctrl+\`<br> | ||
The command for installing extensions is: | ||
```shell | ||
code-server --install-extension ms-python.python | ||
# or to install multiple | ||
code-server --install-extension ms-python.python --install-extension redhat.vscode-yaml | ||
``` | ||
> NOTE: Extensions installed using this method will not persist between container rebuilds | ||
|
||
3. Installing in entrypoint.sh<br> | ||
You can add this command before or after the last line in entrypoint.sh to automatically install extensions in between container rebuilds | ||
```shell | ||
/usr/bin/entrypoint.sh --install-extension ms-python.python | ||
# or to install multiple | ||
/usr/bin/entrypoint.sh --install-extension ms-python.python --install-extension redhat.vscode-yaml | ||
# alternate method to install multiple | ||
/usr/bin/entrypoint.sh --install-extension ms-python.python | ||
/usr/bin/entrypoint.sh --install-extension redhat.vscode-yaml | ||
``` | ||
#### Installing before vs after launching code-server.<br> | ||
If you install the extensions before running code-server, then you will need to wait for the installation process to finish before you are able to use code-server. During this time, you will get 502 Bad Gateway.<br> | ||
<br> | ||
If you install after running code-server, you will be able to use code-server but will need to refresh to use extensions after they are installed. | ||
> NOTE: While technically extensions installed using this method will NOT PERSIST bewtween container rebuilds, they will automatically be reinstalled | ||
<br> | ||
|
||
> NOTE: These extensions are installed User-wide | ||
___ | ||
### Pushing and pulling with rclone | ||
While you could always use | ||
```shell | ||
# How to use: | ||
|
||
$ sh /home/coder/push_remote.sh # save your uncomitted files to the remote | ||
|
||
$ sh /home/coder/pull_remote.sh # get latest files from the remote | ||
``` | ||
from the terminal, it may get repetetive and inconvinient.<br> | ||
Let's see how we can fix that.<br> | ||
#### VSCode Tasks | ||
You can make tasks for pushing and pull with rclone.<br> | ||
1. Create a tasks.json file in the deploy-container folder with these contents | ||
```json5 | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "push_remote", | ||
"type": "shell", | ||
"command": "sh /home/coder/push_remote.sh", | ||
"presentation": { | ||
"reveal": "always", | ||
}, | ||
"problemMatcher": [], | ||
"options": { | ||
"statusbar": { | ||
"label": "$(repo-push) push" | ||
} | ||
} | ||
}, | ||
{ | ||
"label": "pull_remote", | ||
"type": "shell", | ||
"command": "sh /home/coder/pull_remote.sh", | ||
"presentation": { | ||
"reveal": "always", | ||
}, | ||
"problemMatcher": [], | ||
"options": { | ||
"statusbar": { | ||
"label": "$(repo-pull) pull" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
2. Add this command to the Dockerfile | ||
```Dockerfile | ||
# Apply VSCode tasks | ||
COPY deploy-container/tasks.json /home/coder/.local/share/code-server/User/tasks.json | ||
``` | ||
Once the container gets rebuilt, whenever you launch code-server, there will be 2 User-level tasks available. You can use Ctrl+Shift+P to open the command pallete and type `tasks: run task` press enter, select `push_remote` or `pull_remote` and press enter. A terminal will popup showing the output of the task.<br> | ||
<br> | ||
A faster method to run tasks using the command pallete is to backspace the default `>` and type `task`, press space and then the name of the task you want to run.<br> | ||
<br> | ||
The best part about tasks is that you can bind keys to them. Take a look [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks).<br> | ||
If you choose to do so, create your keybindings.json file in the deploy-container directory and then add this command to the Dockerfile | ||
```Dockerfile | ||
# Apply VSCode keybindings | ||
COPY deploy-container/keybindings.json /home/coder/.local/share/code-server/User/keybindings.json | ||
``` | ||
These keybinds will be User-level. | ||
> NOTE: You can of course, always add more tasks and keybinds to these files. They don't just need to be related to rclone. | ||
|
||
3 (Optional). Creating buttons for pushing and pulling from remote in the status bar<br> | ||
If you have used VSCode tasks before, you may have noticed that the push and pull remote tasks contained some metadata in the options property. This data is used by the [tasks extension](https://marketplace.visualstudio.com/items?itemName=actboy168.tasks) to display buttons in the status bar that you can click to run the tasks. How convenient!. You can install the extension each time the container gets rebuilt or by adding a line in entrypoint.sh as explained [here](#installing-extensions); the extension id is `actboy168.tasks`; take a look at the extension's readme to see how to configure it. | ||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to add this by default into the Dockerfile for those who use rclone. :)