feat(Compose): Passage à Docker Compose et simplification Docker
This commit is contained in:
parent
c583cbf108
commit
329b069872
10
Caddyfile
Normal file
10
Caddyfile
Normal file
@ -0,0 +1,10 @@
|
||||
:80 {
|
||||
|
||||
root * /usr/share/caddy
|
||||
file_server
|
||||
|
||||
handle_errors {
|
||||
rewrite * /{http.error.status_code}.html
|
||||
file_server
|
||||
}
|
||||
}
|
19
Dockerfile
19
Dockerfile
@ -5,22 +5,21 @@ COPY 1.patch 2.patch /opt/
|
||||
# Récupération de Rawdog
|
||||
RUN apk update \
|
||||
&& apk add --no-cache git patch \
|
||||
&& mkdir /opt/rawdog \
|
||||
&& git clone https://github.com/echarlie/rawdog-py3.git /opt/rawdog \
|
||||
&& cd /opt/rawdog \
|
||||
&& mkdir -p /opt/rawdog/bin \
|
||||
&& git clone https://github.com/echarlie/rawdog-py3.git /opt/rawdog/bin \
|
||||
&& cd /opt/rawdog/bin \
|
||||
&& mv /opt/1.patch . \
|
||||
&& mv /opt/2.patch . \
|
||||
&& patch -p1 -i 1.patch \
|
||||
&& patch -p1 -i 2.patch \
|
||||
&& pip install --no-cache-dir feedparser \
|
||||
&& python3 setup.py install \
|
||||
&& mkdir -p /srv/http/veille
|
||||
&& python3 setup.py install
|
||||
|
||||
COPY public/ /srv/http/veille/
|
||||
COPY . /opt/rawdog
|
||||
COPY ./crontabs /etc/crontabs/root
|
||||
|
||||
WORKDIR /opt/rawdog
|
||||
|
||||
VOLUME /srv/http/veille
|
||||
VOLUME /root/.rawdog
|
||||
VOLUME /etc/periodic/hourly
|
||||
ENTRYPOINT ["crond", "-f", "-l", "8"]
|
||||
VOLUME /opt/rawdog/public
|
||||
|
||||
ENTRYPOINT ["/opt/rawdog/startup.sh"]
|
||||
|
38
README.md
38
README.md
@ -6,36 +6,16 @@ C'est un système simple utilisant [Rawdog](https://offog.org/code/rawdog/) pour
|
||||
|
||||
Il se lance toutes les heures pour générer - si besoin - une page.
|
||||
|
||||
# Installation
|
||||
# Dépendances
|
||||
|
||||
## Dépendances
|
||||
* Docker
|
||||
* Docker Compose
|
||||
|
||||
|
||||
* [rawdog](https://archlinux.org/packages/community/any/rawdog/) pour ArchLinux
|
||||
|
||||
## Dossiers à créér/installer
|
||||
|
||||
* copier le **contenu du dossier `rawdog`** dans **/home/od/.rawdog/**
|
||||
* copier le **contenu du dossier `public`** dans **/srv/http/ogre/veille/**
|
||||
* copier les fichiers `rawdog.service` et `rawdog.timer` dans **/etc/systemd/system/**
|
||||
* configurer le fichier **/home/od/.rawdog/config** pour adapter la ligne suivante :
|
||||
|
||||
```python
|
||||
outputfile /srv/http/ogre/veille/index.html
|
||||
```
|
||||
|
||||
avec l'adresse exacte où vous avez posé les fichiers du dossier *public*.
|
||||
|
||||
|
||||
# En bref
|
||||
# Utilisation
|
||||
|
||||
```bash
|
||||
rsync -avP ./rawdog/* /home/od/.rawdog
|
||||
mkdir /srv/http/ogre/veille -p
|
||||
rsync -avP ./public/* /srv/http/ogre/veille/
|
||||
sudo cp rawdog.service /etc/systemd/system/
|
||||
sudo cp rawdog.timer /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable rawdog.timer
|
||||
sudo systemctl start rawdog.service
|
||||
```
|
||||
cp env.example .env
|
||||
make && docker-compose up -d
|
||||
```
|
||||
|
||||
Le site est disponible sur http://localhost:8888/.
|
||||
|
0
rawdog/.gitignore → config/.gitignore
vendored
0
rawdog/.gitignore → config/.gitignore
vendored
@ -147,7 +147,7 @@ feeditemtemplate default
|
||||
# directory. Specify this as "-" to write the HTML to stdout.
|
||||
# (You will probably want to make this an absolute path, else rawdog will write
|
||||
# to a file in your ~/.rawdog directory.)
|
||||
outputfile /srv/http/veille/index.html
|
||||
outputfile /opt/rawdog/public/index.html
|
||||
#outputfile /home/you/public_html/rawdog.html
|
||||
|
||||
# Whether to use a <meta http-equiv="Refresh" ...> tag in the generated
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
generator:
|
||||
image: rawdog:0.1
|
||||
volumes:
|
||||
- ${PWD}/public:/opt/rawdog/public:rw
|
||||
cron:
|
||||
image: rawdog:0.1
|
||||
restart: always
|
||||
entrypoint: /usr/sbin/crond
|
||||
command: ["-f", "-l", "8"]
|
||||
volumes:
|
||||
- ${PWD}/public:/opt/rawdog/public:rw
|
||||
environment:
|
||||
- UTILISATEUR
|
||||
|
||||
web:
|
||||
image: caddy:2-alpine
|
||||
restart: always
|
||||
volumes:
|
||||
- ${PWD}/public:/usr/share/caddy:ro
|
||||
- ${PWD}/Caddyfile:/etc/caddy/Caddyfile
|
||||
ports:
|
||||
- 8888:80
|
1
env.example
Normal file
1
env.example
Normal file
@ -0,0 +1 @@
|
||||
UTILISATEUR=1000
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
UTILISATEUR=${UTILISATEUR:-1000}
|
||||
|
||||
/opt/rawdog/rawdog -d /root/.rawdog -uw && chown ${UTILISATEUR} /srv/http/veille -R || exit 1
|
@ -1,7 +0,0 @@
|
||||
[Unit]
|
||||
Description=Rawdog
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=od
|
||||
ExecStart=/usr/bin/rawdog -d /home/od/.rawdog -uw
|
10
rawdog.timer
10
rawdog.timer
@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Runs rawdog every hour
|
||||
|
||||
[Timer]
|
||||
OnCalendar=hourly
|
||||
Persistent=True
|
||||
Unit=rawdog.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
5
startup.sh
Executable file
5
startup.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
UTILISATEUR=${UTILISATEUR:-1000}
|
||||
|
||||
/opt/rawdog/bin/rawdog -d /opt/rawdog/config -uw && chown ${UTILISATEUR} /opt/rawdog/public -R || exit 1
|
Loading…
Reference in New Issue
Block a user