This is an extension to the Svelte-PWA template at https://github.com/tretapey/svelte-pwa. It features a simple setup with Traefik using docker-compose that allows easy self-hosting webpages using DuckDNS. It features redirection from HTTP to HTTPS, and ACME DNS challenge using LetsEncrypt.
To create a new project base on this template using degit:
npx degit pedroallenrevez/svelte-pwa-traefik my-svelte-pwa-traefik
cd my-svelte-pwa-traefik
Note that you will need to have Node.js installed.
Install the dependencies...
cd my-svelte-pwa-traefik/app
npm install
...then start Rollup:
npm run dev
Navigate to localhost:5000. You should see your app running. Edit a component file in src
, save it, and reload the page to see your changes.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv
commands in package.json to include the option --host 0.0.0.0
.
Replace your credentials in following places:
DUCKDNS_TOKEN
- docker-compose.yml
- replace with the token provided by DuckDNSconfig/traefik.yml
- the email provided to DuckDNS.config/traefik.yml
and config/dynamic_conf.yml
Refer to https://doc.traefik.io/traefik documentation for more information on the configuration.
To create a containerized version of the app:
docker-compose build
docker-compose up
Note that you will need to port-forward ports 80 and 443 to the machine that is hosting the webpage.