diff --git a/README.md b/README.md index 181508cf..89b82be4 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ If you have a spare domain name you can configure applications to be accessible * [Ubooquity](http://vaemendis.net/ubooquity/) - Book and comic server * [uTorrent](https://www.utorrent.com/) - The best torrent downloading app for beginners * [Virtual Desktop](https://github.com/RattyDAVE/docker-ubuntu-xrdp-mate-custom) - A virtual desktop running on your NAS. +* [Code](https://code.visualstudio.com/) - Powerful and open source IDE accessible through the browser * [Wallabag](https://wallabag.org/) - Save and classify articles. Read them later. * [Watchtower](https://github.com/v2tec/watchtower) - Monitor your Docker containers and update them if a new version is available * [Wireshark](https://www.wireshark.org/) - the world’s foremost and widely-used network protocol analyzer. diff --git a/group_vars/all.yml b/group_vars/all.yml index 93a9118a..56ab90b0 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -68,6 +68,9 @@ photos_root: "{{ samba_shares_root }}/photos" # Where paperless_ng consumes documents documents_root: "{{ samba_shares_root }}/documents" +# Where personal repos and code are stored +code_root: "{{ samba_shares_root }}/code" + # The description that'll appear next to your Ansible-NAS box when browsing your network samba_server_string: Ansible NAS @@ -169,6 +172,14 @@ samba_shares: browseable: yes path: "{{ documents_root }}" + - name: code + comment: "Code" + guest_ok: yes + public: yes + writable: yes + browseable: yes + path: "{{ code_root }}" + ### ### NFS ### diff --git a/nas.yml b/nas.yml index ee0f7e6d..ece97165 100644 --- a/nas.yml +++ b/nas.yml @@ -420,6 +420,11 @@ - virtual_desktop when: (virtual_desktop_enabled | default(False)) + - role: code-server + tags: + - code-server + when: (code_server_enabled | default(False)) + - role: wallabag tags: - wallabag diff --git a/roles/code-server/defaults/main.yml b/roles/code-server/defaults/main.yml new file mode 100644 index 00000000..2ca797e2 --- /dev/null +++ b/roles/code-server/defaults/main.yml @@ -0,0 +1,18 @@ +--- +code_server_enabled: false +code_server_available_externally: false + +# directories +code_server_config_directory: "{{ docker_home }}/code_server" +code_server_projects_directory: "{{ code_root }}" + +# uid / gid +code_server_user_id: "0" +code_server_group_id: "0" + +# network +code_server_port: "8443" +code_server_hostname: "code-server" + +# specs +code_server_memory: 1g diff --git a/roles/code-server/tasks/main.yml b/roles/code-server/tasks/main.yml new file mode 100644 index 00000000..c9c817c1 --- /dev/null +++ b/roles/code-server/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: Code Server Docker Container + docker_container: + name: code_server + image: linuxserver/code-server + pull: true + volumes: + - "{{ code_server_config_directory }}:/config" + - "{{ code_server_projects_directory }}:/code:rw" + ports: + - "{{ code_server_port }}:8443" + env: + TZ: "{{ ansible_nas_timezone }}" + DEFAULT_WORKSPACE: "/code" + PUID: "{{ code_server_user_id }}" + PGID: "{{ code_server_group_id }}" + restart_policy: unless-stopped + memory: "{{ code_server_memory }}" + labels: + traefik.enable: "{{ code_server_available_externally | string }}" + traefik.http.routers.code_server.rule: "Host(`{{ code_server_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.code_server.tls.certresolver: "letsencrypt" + traefik.http.routers.code_server.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.code_server.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.code_server.loadbalancer.server.port: "8443"