Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pillar/base/planet.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@ planet:
- planetpython.org
- www.planetpython.org
sites:
planetpython.org:
planetpython:
cache: /srv/cache/
output: /srv/planetpython.org/
image: ghcr.io/python/planetpython:latest
config: config.ini
planetpython-3:
cache: /srv/cache3/
output: /srv/planetpython.org/3/
image: ghcr.io/python/planetpython-3:latest
config: config.ini
9 changes: 7 additions & 2 deletions salt/planet/config/run-planet.sh.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cd /srv/planet/
git pull
{% for site in salt["pillar.get"]("planet", {}).get("sites").values() %}
$(which python2.7) /srv/planet/code/planet.py /srv/planet/config/{{ site["config"] }}
{% for site, site_config in salt["pillar.get"]("planet", {}).get("sites").items() %}
docker run --rm -it \
-v {{ site_config["cache"] }}:/srv/cache/ \
-v {{ site_config["output"] }}:/srv/planetpython.org/ \
-v /srv/planet/config/{{ site_config["config"] }}:/planet/config/config.ini \
{{ site_config["image"] }} \
python /planet/code/planet.py /planet/config/config.ini
{% endfor %}
31 changes: 20 additions & 11 deletions salt/planet/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ include:
git:
pkg.installed

docker.io:
pkg.installed
docker:
service.running:
- enable: True

planet-user:
user.present:
- name: planet
- createhome: False
- groups:
- docker
- require:
- pkg: docker.io

/etc/nginx/sites.d/planet.conf:
file.managed:
Expand Down Expand Up @@ -40,20 +50,14 @@ planet-user:

https://github.com/python/planet:
git.latest:
- branch: py2
- branch: main
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're effectively just using this for the config file now, so back to main.

- target: /srv/planet/
- user: planet
- require:
- user: planet-user
- pkg: git
- file: /srv/planet/

/srv/cache/:
file.directory:
- user: planet
- group: planet
- mode: "0770"

/srv/run-planet.sh:
file.managed:
- source: salt://planet/config/run-planet.sh.jinja
Expand All @@ -67,18 +71,23 @@ https://github.com/python/planet:
- minute: 37
- hour: 1,4,7,10,13,16,19,21

{% for site in salt["pillar.get"]("planet", {}).get("sites", []) %}
/srv/{{ site }}/:
{% for site, site_config in salt["pillar.get"]("planet", {}).get("sites", {}).items() %}
{{ site_config["cache"] }}:
file.directory:
- user: planet
- group: planet
- mode: "0755"
{{ site_config["output"] }}:
file.directory:
- user: planet
- group: planet
- mode: "0755"
/srv/{{ site }}/static:
{{ site_config["output"] }}/static:
file.symlink:
- target: /srv/planet/static
- user: planet
- group: planet
- mode: "0644"
- require:
- file: /srv/{{ site }}/
- file: {{ site_config["output"] }}
{% endfor %}