]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Regroup all editable files in one place 94/head
authorBastien Wirtz <bastien.wirtz@gmail.com>
Wed, 24 Jun 2020 05:56:33 +0000 (22:56 -0700)
committerBastien Wirtz <bastien.wirtz@gmail.com>
Sun, 28 Jun 2020 18:05:40 +0000 (11:05 -0700)
.dockerignore
Dockerfile
Dockerfile.arm32v7
Dockerfile.arm64v8
README.md
docs/configuration.md
docs/tips-and-tricks.md
entrypoint.sh
public/assets/config.yml.dist [moved from public/config.yml.dist with 100% similarity]
public/assets/config.yml.dist.sample-sui [moved from public/config.yml.dist.sample-sui with 100% similarity]
src/App.vue

index 6d0170149e5ccec998eb629ca156ba1e88c1b970..461e021f584c930e4c9abaacda04c23d041b438d 100644 (file)
@@ -2,4 +2,5 @@ assets/*
 dockerfile
 *.md
 .git
-screenshot.png
\ No newline at end of file
+screenshot.png
+node_modules
index cd3ab118cc5e32906aef57a14312b63745b7af7a..03751124aebfe2a0df8a084c1ea6681c4bbb9b33 100644 (file)
@@ -19,12 +19,12 @@ ENV UID 911
 ENV PORT 8080
 
 RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \
-    apk add -U darkhttpd
+    apk add -U --no-cache su-exec darkhttpd
 
 COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
+COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
 COPY --chown=${USER}:${GROUP} entrypoint.sh /entrypoint.sh
 
-USER ${USER}
 EXPOSE ${PORT}
-VOLUME [ "/www/config.yml", "/www/assets" ]
+VOLUME /www/assets
 ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
index ef01d1fb2dbf1dc3ba5a21e0c30a743990d7a0fc..ba9c95d1ada6db5db6dd6841a19bc97ca5186668 100644 (file)
@@ -32,9 +32,10 @@ RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} &
     rm /usr/bin/qemu-arm-static
 
 COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
+COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
 COPY --chown=${USER}:${GROUP} entrypoint.sh /entrypoint.sh
 
 USER ${USER}
 EXPOSE ${PORT}
-VOLUME [ "/www/config.yml", "/www/assets" ]
+VOLUME /www/assets
 ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
index 7899027743a20f9b55751457b98bf8d4c9a9742b..4e307d834442fb0b12630717384b71faff1e8892 100644 (file)
@@ -32,9 +32,10 @@ RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} &
     rm /usr/bin/qemu-aarch64-static
 
 COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
+COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
 COPY --chown=${USER}:${GROUP} entrypoint.sh /entrypoint.sh
 
 USER ${USER}
 EXPOSE ${PORT}
-VOLUME [ "/www/config.yml", "/www/assets" ]
+VOLUME /www/assets
 ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
index 65ef9ab92fc21fe5fc1d088df9ecaf3249c9bdf4..7d76b0e4b1ae69474c1b3d3e3a15aa2bf47aa643 100644 (file)
--- a/README.md
+++ b/README.md
@@ -38,31 +38,25 @@ ervices on hand, from a simple `yaml` configuration file.
 
 Homer is a full static html/js dashboard, generated from the source in `/src` using webpack. It's meant to be served by an HTTP server, **it will not work if you open dist/index.html directly over file:// protocol**.
 
-For more information about the `config.yml` file see [configuration](docs/configuration.md) the section.
+See [documentation](docs/configuration.md) for information about the configuration (`assets/config.yml`) options.
 
 ### Using docker
 
 ```sh
-docker run -p 8080:8080 -v /your/local/config.yml:/www/config.yml -v /your/local/assets/:/www/assets b4bz/homer:latest
+docker run -p 8080:8080 -v /your/local/assets/:/www/assets b4bz/homer:latest
 ```
 
-As a bind mount is used here, docker will not copy the initial content of the `assets` directory to the mounted directory. 
-You can initialise your assets directory with the content provided in this repository
-```sh
-cp -r /public/assets/* /your/local/assets/
-```
-
-**Alternatively** if you just want to provide images/icons without customizing the other files (app manifest & pwa icons), you can mount a custom directory in the `www` directory and use it in your `config.yml` for icons path.
+Default assets will be automatically installed in the `/www/assets` directory. Use `UID` and/or `GID` env var to change the assets owner (`docker run -e "UID=1000" -e "GID=1000" [...]`).
 
 ### Using the release tarball (prebuilt, ready to use)
 
-Download and extract the latest the latest release (`homer.zip`) from the [release page](https://github.com/bastienwirtz/homer/releases), rename the `config.yml.dist` file to `config.yml`, and put it behind a webserver.
+Download and extract the latest the latest release (`homer.zip`) from the [release page](https://github.com/bastienwirtz/homer/releases), rename the `assets/config.yml.dist` file to `assets/config.yml`, and put it behind a webserver.
  
 ```sh
 wget https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip
 unzip homer.zip
 cd homer
-cp config.yml.dist config.yml
+cp assets/config.yml.dist assets/config.yml
 npx serve # or python -m http.server 8010 or apache, nginx ...
 ```
 
index a2469ed515c40374ad5ca00c736ca021261ef403..409db345f773d3a4e38c5c9c6cf7cb67733dd47b 100644 (file)
@@ -1,6 +1,6 @@
 ## Configuration
 
-Title, icons, links, colors, and services can be configured in the `config.yml` file (located in project root directory once built, or in the `public/` directory in developement mode), using [yaml](http://yaml.org/) format.
+Title, icons, links, colors, and services can be configured in the `config.yml` file (located in `/assets` directory once built, or in the `public/assets` directory in developement mode), using [yaml](http://yaml.org/) format.
 
 ```yaml
 ---
index 632b62dec6e4b79d651ed42eddcc0812790cb3f2..fda670daadcd0b066ff68c8a1a580f5b4adef221 100644 (file)
@@ -74,7 +74,7 @@ Great if you have a lot of services or a lot of tags!
 
 Homer doesn't yet provide a way to edit your configuration from inside Homer itself, but that doesnt mean it cant be done!
 
-You can setup and use [Code-Server](https://github.com/cdr/code-server) to edit your config.yml file from anywhere!
+You can setup and use [Code-Server](https://github.com/cdr/code-server) to edit your `config.yml` file from anywhere!
 
 If you're running Homer in docker, you can setup a Code-Server container and pass your homer config directory into it.
 Simply pass your homer config directory as and extra -v parameter to your code-server container:
index 7623322067fdf874375a9bee0cb77d7eb229a44f..dd55cdbb5ed05827ed389ca5a266bfd48bf651a9 100644 (file)
@@ -1,6 +1,15 @@
 #!/bin/sh
 
-yes n | cp -i /www/config.yml.dist /www/config.yml
-while true; do echo n; done | cp -Ri /app/dist/www/assets /www/assets 2>/dev/null
+# Ensure default assets are present.
+while true; do echo n; done | cp -Ri /www/default-assets/* /www/assets/ &> /dev/null
 
-darkhttpd /www/ --no-listing --port $PORT
+# Ensure compatibility with previous version (config.yml was in the root directory)
+if [ -f "/www/config.yml" ]; then
+    yes n | cp -i /www/config.yml /www/assets/ &> /dev/null
+fi
+
+# Install default config if no one is available.
+yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null
+
+chown -R $UID:$GID /www/assets/*
+exec su-exec $USER:$GROUP darkhttpd /www/ --no-listing --port "$PORT"
index 17c32143b44cc93d4740f2cd6fdb547e00f2e0f4..613c743716b58757becaa41e3a4b18b04a034e2a 100644 (file)
@@ -156,7 +156,7 @@ export default {
     document.title = `${this.config.title} | ${this.config.subtitle}`;
   },
   methods: {
-    getConfig: function (path = "config.yml") {
+    getConfig: function (path = "assets/config.yml") {
       return fetch(path).then((response) => {
         if (!response.ok) {
           throw Error(response.statusText);