├── config.json ├── Dockerfile ├── kubernetes └── manifest.yaml ├── script.sh └── README.md /config.json: -------------------------------------------------------------------------------- 1 | { "timeout": "600000" } 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM dockette/rendertron:latest 2 | 3 | RUN apt-get update && apt-get -y install curl 4 | 5 | ENV SITE="https://stop-russian-desinformation.near.page/" 6 | 7 | # script to run rendertron and open URL https://stop-russian-desinformation.near.page/ 8 | COPY script.sh config.json ./ 9 | 10 | # tune permissions 11 | RUN chmod 777 config.json 12 | RUN chmod +x script.sh 13 | 14 | CMD ./script.sh 15 | -------------------------------------------------------------------------------- /kubernetes/manifest.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | piVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: fckrussia 6 | spec: 7 | selector: 8 | matchLabels: 9 | run: fckrussia 10 | replicas: 5 11 | template: 12 | metadata: 13 | labels: 14 | run: fckrussia 15 | spec: 16 | containers: 17 | - name: fckrussia 18 | image: kuzmichm/desinform-stop 19 | env: 20 | - name: SITE 21 | value: "https://cocky-hugle-0729da.netlify.app/" 22 | resources: 23 | requests: 24 | cpu: "2" 25 | memory: "2Gi" 26 | limits: 27 | cpu: "4" 28 | memory: "4Gi" 29 | -------------------------------------------------------------------------------- /script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # turn on bash's job control 4 | set -m 5 | 6 | # Start the primary process and put it in the background 7 | # rendertron - headless Chrome rendering solution 8 | npm run start & 9 | 10 | # the curl might need to know how to wait on the 11 | # primary process to start before it does its work and returns 12 | sleep 10 13 | 14 | # Start open stop-russions-desinform site 15 | for i in {1..1000}; do curl http://localhost:3000/render/$SITE && sleep 15; done & 16 | 17 | # now we bring the primary process back into the foreground 18 | # and leave it there 19 | fg %1 20 | 21 | # Wait for any process to exit 22 | wait -n 23 | 24 | # Exit with status of process that exited first 25 | exit $? 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-stop-sites 2 | 3 | To stop russion desinformation on servers using simple docker run 4 | 5 | ## Docker install for Ubuntu 6 | ``` 7 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 8 | 9 | echo \ 10 | "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ 11 | $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 12 | 13 | sudo apt-get update 14 | sudo apt-get install docker-ce docker-ce-cli containerd.io 15 | 16 | sudo groupadd docker 17 | sudo usermod -aG docker $USER # for running docker without sudo 18 | sudo reboot 19 | ``` 20 | 21 | ## Usage 22 | ``` 23 | docker run --restart=always --detach --name=desinform_stop --pull=always kuzmichm/desinform-stop 24 | ``` 25 | 26 | where: 27 | 28 | `--restart=always` - run after reboot 29 | 30 | `--detach` - run in separate process 31 | 32 | ` --name=desinform_stop` - assign a name to the container 33 | 34 | ` --pull=always` - pull image before running 35 | 36 | By default config source site is https://stop-russian-desinformation.near.page/, but in case you want to use another site, set it as ENV variable. 37 | ``` 38 | docker run --restart=always --detach --name=desinform_stop --pull=always -e SITE='https://cocky-hugle-0729da.netlify.app/' kuzmichm/desinform-stop 39 | ``` 40 | 41 | ### Crontab setup(required) 42 | Set up cron to restart container every 3rd hour to ensure that it is always running. This command will add new line to crontab. 43 | ``` 44 | (crontab -l && echo "0 */3 * * * docker restart desinform_stop") | crontab - 45 | # in case of error run this command twice 46 | (crontab -l && echo "0 */3 * * * docker restart desinform_stop") | crontab - 47 | # verify crontab 48 | crontab -l 49 | ``` 50 | 51 | ## Notes 52 | ### Free cloud resources 53 | This docker image was made to run it on Linux servers. 54 | Please note that many cloud providers give some free resources for trial period. Please check this links: 55 | 1) https://cloud.google.com/free - option one, the most safe 56 | New customers also get $300 in free credits to fully explore and conduct an assessment of Google Cloud Platform. You won’t be charged until you choose to upgrade. 57 | 58 | 2) https://azure.microsoft.com/en-us/free/ - second option, check billing as additional charges can be after you use 200$ Azure credits 59 | 60 | ## Pull requests are welcome 61 | --------------------------------------------------------------------------------