local-dev.md (2389B)
1 # Local Development 2 ## Install 3 4 First, [Install docker with docker-compose.](https://docs.docker.com/compose/install/) 5 6 Then, clone the repository: 7 ``` 8 git clone https://github.com/RobinLinus/snapdrop.git 9 cd snapdrop 10 docker-compose up -d 11 ``` 12 Now point your browser to `http://localhost:8080`. 13 14 - To restart the containers run `docker-compose restart`. 15 - To stop the containers run `docker-compose stop`. 16 - To debug the NodeJS server run `docker logs snapdrop_node_1`. 17 18 19 20 21 22 ## Testing PWA related features 23 PWAs require that the app is served under a correctly set up and trusted TLS endpoint. 24 25 The nginx container creates a CA certificate and a website certificate for you. To correctly set the common name of the certificate, you need to change the FQDN environment variable in `docker/fqdn.env` to the fully qualified domain name of your workstation. 26 27 If you want to test PWA features, you need to trust the CA of the certificate for your local deployment. For your convenience, you can download the crt file from `http://<Your FQDN>:8080/ca.crt`. Install that certificate to the trust store of your operating system. 28 - On Windows, make sure to install it to the `Trusted Root Certification Authorities` store. 29 - On MacOS, double click the installed CA certificate in `Keychain Access`, expand `Trust`, and select `Always Trust` for SSL. 30 - Firefox uses its own trust store. To install the CA, point Firefox at `http://<Your FQDN>:8080/ca.crt`. When prompted, select `Trust this CA to identify websites` and click OK. 31 - When using Chrome, you need to restart Chrome so it reloads the trust store (`chrome://restart`). Additionally, after installing a new cert, you need to clear the Storage (DevTools -> Application -> Clear storage -> Clear site data). 32 33 Please note that the certificates (CA and webserver cert) expire after a day. 34 Also, whenever you restart the nginx docker, container new certificates are created. 35 36 The site is served on `https://<Your FQDN>:443`. 37 38 ## Deployment Notes 39 The client expects the server at http(s)://your.domain/server. 40 41 When serving the node server behind a proxy, the `X-Forwarded-For` header has to be set by the proxy. Otherwise, all clients that are served by the proxy will be mutually visible. 42 43 By default, the server listens on port 3000. 44 45 For an nginx configuration example, see `docker/nginx/default.conf`. 46 47 [< Back](/README.md)