Move to a docker-compose setup

This commit is contained in:
Luke Murphy 2020-05-01 10:30:31 +02:00
parent 34aca195ce
commit 5b7ee79c5d
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
10 changed files with 110 additions and 24 deletions

View File

@ -11,6 +11,26 @@ steps:
trigger: trigger:
branch: branch:
- master - master
event:
exclude: ---
- pull_request kind: pipeline
name: deploy to swarm.autonomic.zone
steps:
- name: deployment
image: decentral1se/drone-stack:19.03.8-override-compose
settings:
compose: docker-compose.yml
host: tcp://swarm.autonomic.zone:2376
override_compose: docker-compose.production.yml
stack_name: traefik
tlsverify: true
environment:
PLUGIN_CACERT:
from_secret: docker_cacert
PLUGIN_CERT:
from_secret: docker_cert
PLUGIN_KEY:
from_secret: docker_key
trigger:
branch:
- master

View File

@ -15,23 +15,33 @@ with.
## Deploy It ## Deploy It
1. Push your changes to master and Dokku will try to automatically release Just push your changes to master and it will be deploy. See [Drone](https://drone.autonomic.zone/autonomic-cooperative/autonomic.zone/) for more.
1. See the [Drone dashboard to see the build](https://drone.autonomic.zone/autonomic-cooperative/autonomic.zone/)
## Hack On It ## Hack On It
The only prerequisite is [Docker](https://www.docker.com/). If you're on Debian, installing is easy. The prerequisites are [Docker](https://www.docker.com/) and [Docker-compose](https://docs.docker.com/compose/).
If you're on Debian, installing is easy.
Install Docker.
```bash ```bash
$ curl -fsSL https://get.docker.com -o get-docker.sh # have a look if you want $ curl -fsSL https://get.docker.com -o get-docker.sh # have a look if you want
$ CHANNEL=stable sh get-docker.sh $ CHANNEL=stable sh get-docker.sh
``` ```
Fire up the container with the following. Install Docker-compose.
```bash ```bash
$ make build # only the first time or when changing container $ cd autonomic.zone
$ make serve $ python3 -m venv .venv
$ pip install -r requirements.txt
```
Then fire up the container with the following.
```bash
$ docker-compose up
``` ```
Then visit the locally running website. Then visit the locally running website.
@ -43,7 +53,7 @@ Then you can edit the files as normal and reload the page.
To stop the container when you're done, you can run: To stop the container when you're done, you can run:
```bash ```bash
$ make stop $ docker-compose stop
``` ```
## Notes ## Notes

View File

@ -1,4 +1,4 @@
source "https://rubygems.org" source "https://rubygems.org"
ruby '2.6.5' ruby "2.7.1"
gemspec gemspec
gem 'jekyll-feed' gem "jekyll-feed"

View File

@ -40,7 +40,8 @@ GEM
sassc (> 2.0.1, < 3.0) sassc (> 2.0.1, < 3.0)
jekyll-watch (2.2.1) jekyll-watch (2.2.1)
listen (~> 3.0) listen (~> 3.0)
kramdown (2.1.0) kramdown (2.2.1)
rexml
kramdown-parser-gfm (1.1.0) kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0) kramdown (~> 2.0)
liquid (4.0.3) liquid (4.0.3)
@ -50,13 +51,14 @@ GEM
mercenary (0.3.6) mercenary (0.3.6)
pathutil (0.16.2) pathutil (0.16.2)
forwardable-extended (~> 2.6) forwardable-extended (~> 2.6)
public_suffix (4.0.3) public_suffix (4.0.4)
rb-fsevent (0.10.3) rb-fsevent (0.10.4)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
rouge (3.17.0) rexml (3.2.3)
rouge (3.18.0)
safe_yaml (1.0.5) safe_yaml (1.0.5)
sassc (2.2.1) sassc (2.3.0)
ffi (~> 1.9) ffi (~> 1.9)
terminal-table (1.8.0) terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (~> 1.1, >= 1.1.1)
@ -72,7 +74,7 @@ DEPENDENCIES
jekyll-feed jekyll-feed
RUBY VERSION RUBY VERSION
ruby 2.6.5p114 ruby 2.7.1p83
BUNDLED WITH BUNDLED WITH
2.1.4 2.1.4

View File

@ -2,7 +2,9 @@
[![Build Status](https://drone.autonomic.zone/api/badges/autonomic-cooperative/autonomic.zone/status.svg)](https://drone.autonomic.zone/autonomic-cooperative/autonomic.zone) [![Build Status](https://drone.autonomic.zone/api/badges/autonomic-cooperative/autonomic.zone/status.svg)](https://drone.autonomic.zone/autonomic-cooperative/autonomic.zone)
> https://autonomic.zone > https://autonomic.zone (dokku version)
> https://site.swarm.autonomic.zone (swarm version)
A [Jekyll] based site for the Autonomic Cooperative. The site is based on the [spectral-jekyll-theme] template. A [Jekyll] based site for the Autonomic Cooperative. The site is based on the [spectral-jekyll-theme] template.

View File

@ -2,13 +2,13 @@
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "autonomic" spec.name = "autonomic"
spec.version = '0.0.0' spec.version = "0.0.0"
spec.date = '2017-09-24' spec.date = "2017-09-24"
spec.summary = "" spec.summary = ""
spec.description = "" spec.description = ""
spec.authors = ['autonomic co-operative'] spec.authors = ["autonomic co-operative"]
spec.email = 'autonomic.posteo.net' spec.email = "autonomic.posteo.net"
spec.files = 'README.md' spec.files = "README.md"
spec.add_development_dependency "jekyll", ">= 4" spec.add_development_dependency "jekyll", ">= 4"
spec.add_development_dependency "bundler", ">= 2.1.4" spec.add_development_dependency "bundler", ">= 2.1.4"

View File

@ -0,0 +1,9 @@
---
version: "3.7"
services:
jekyll:
command: |
jekyll serve --watch --force_polling --verbose --config _config_dev.yml
volumes:
- .:/srv/jekyll

View File

@ -0,0 +1,34 @@
---
version: "3.7"
services:
jekyll:
command: |
jekyll serve --verbose --config /srv/jekyll/_config_prod.yml
configs:
- source: config-yml-prod-v1
target: /srv/jekyll/_config_prod.yml
networks:
- proxy
deploy:
mode: replicated
replicas: 1
update_config:
failure_action: rollback
placement:
constraints:
- node.role == manager
labels:
- "traefik.enable=true"
- "traefik.http.services.traefik.loadbalancer.server.port=web"
- "traefik.http.routers.traefik.rule=Host(`site.swarm.autonomic.zone`)"
- "traefik.http.routers.traefik.entrypoints=web-secure"
- "traefik.http.routers.traefik.tls.certresolver=staging"
networks:
proxy:
external: true
configs:
config-yml-prod-v1:
file: _config_prod.yml

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
---
version: "3.7"
services:
jekyll:
image: jekyll/jekyll:4
ports:
- "4000:4000"

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
docker-compose==1.7.2