First version of the stack
This commit is contained in:
parent
c515e85c31
commit
5f9592255e
4 changed files with 150 additions and 0 deletions
109
README.md
109
README.md
|
@ -276,8 +276,117 @@ The last step is to publish it!
|
|||
|
||||
## Install Garage
|
||||
|
||||
See: https://garagehq.deuxfleurs.fr/download/
|
||||
|
||||
```
|
||||
docker pull dxflrs/garage:v0.8.1
|
||||
```
|
||||
|
||||
We will use a simple config file you can generate as follow:
|
||||
|
||||
```toml
|
||||
cat > garage.toml <<EOF
|
||||
metadata_dir = "/var/lib/garage/meta"
|
||||
data_dir = "/var/lib/garage/data"
|
||||
db_engine = "lmdb"
|
||||
|
||||
replication_mode = "none"
|
||||
|
||||
rpc_bind_addr = "[::]:3901"
|
||||
rpc_public_addr = "127.0.0.1:3901"
|
||||
rpc_secret = "$(openssl rand -hex 32)"
|
||||
|
||||
[s3_api]
|
||||
s3_region = "garage"
|
||||
api_bind_addr = "[::]:3900"
|
||||
root_domain = ".s3.localhost"
|
||||
|
||||
[s3_web]
|
||||
bind_addr = "[::]:3902"
|
||||
root_domain = ".web.localhost"
|
||||
index = "index.html"
|
||||
|
||||
[k2v_api]
|
||||
api_bind_addr = "[::]:3904"
|
||||
|
||||
[admin]
|
||||
api_bind_addr = "0.0.0.0:3903"
|
||||
admin_token = "$(openssl rand -base64 32)"
|
||||
EOF
|
||||
```
|
||||
|
||||
Configure the layout:
|
||||
|
||||
```bash
|
||||
docker-compose exec garage /garage layout assign -z dc1 -c 1 559ee9e01f610572
|
||||
docker-compose exec garage /garage layout apply --version 1
|
||||
```
|
||||
|
||||
## Configure a website on Garage
|
||||
|
||||
Create a key, a bucket and bind the key on it:
|
||||
|
||||
```bash
|
||||
garage key new --name quentin
|
||||
garage bucket create my-blog
|
||||
garage bucket allow --owner --read --write --key quentin my-blog
|
||||
garage key info quentin
|
||||
```
|
||||
|
||||
Then put the key in a file `awsrc`:
|
||||
|
||||
```bash
|
||||
export AWS_ACCESS_KEY_ID=GKdac05807405e200f8153595f
|
||||
export AWS_SECRET_ACCESS_KEY=5c5710356eafc7d401fd3f5ecf5b50a5f0994f2e68d9fbaf678d91287abbd467
|
||||
export AWS_DEFAULT_REGION='garage'
|
||||
|
||||
function aws { command aws --endpoint-url http://localhost:3900 $@ ; }
|
||||
aws --version
|
||||
```
|
||||
|
||||
Then we need to activate the website feature:
|
||||
|
||||
```bash
|
||||
aws s3 website --index-document index.html s3://my-blog
|
||||
```
|
||||
|
||||
Then test your website:
|
||||
```bash
|
||||
echo "hello world" > /tmp/index.html
|
||||
aws s3 cp /tmp/index.html s3://my-blog/
|
||||
curl -I http://my-blog.web.localhost:3902
|
||||
```
|
||||
|
||||
## Configure Drone to deploy your website on Garage
|
||||
|
||||
Add your keys as a drone secret in your repository.
|
||||
See here: https://docs.drone.io/secret/repository/
|
||||
|
||||
And then add this to your `.drone.yml`:
|
||||
|
||||
```yaml
|
||||
- name: upload
|
||||
image: plugins/s3
|
||||
settings:
|
||||
bucket: my-blog
|
||||
access_key:
|
||||
from_secret: aws_access_key_id
|
||||
secret_key:
|
||||
from_secret: aws_secret_acess_key
|
||||
source: _site/**/*
|
||||
target: /
|
||||
```
|
||||
|
||||
## Profit
|
||||
|
||||
Your blog should be available at this URL: http://my-blog.web.localhost:3902
|
||||
You can administrate it at this URL: http://my-blog.web.localhost:3902/admin/
|
||||
Publishing an article will trigger a build, you can follow it: http://localhost:3002/quentin/my-blog/
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] Nettoyer les inter-connexions entre les services pour ne pas avoir à drop iptables
|
||||
- [ ] Voir comment speed up le build
|
||||
- [ ] Peut-être passer la démo sur Hugo (aiderait le point précédent)
|
||||
- [ ] Tester avec des templates plus complexes (avec des images en bannière)
|
||||
- [ ] Porter ce test sur le guide Zola avec les nested collections
|
||||
|
|
6
awsrc
Normal file
6
awsrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
export AWS_ACCESS_KEY_ID=GKdac05807405e200f8153595f
|
||||
export AWS_SECRET_ACCESS_KEY=5c5710356eafc7d401fd3f5ecf5b50a5f0994f2e68d9fbaf678d91287abbd467
|
||||
export AWS_DEFAULT_REGION='garage'
|
||||
|
||||
function aws { command aws --endpoint-url http://localhost:3900 $@ ; }
|
||||
aws --version
|
|
@ -66,3 +66,12 @@ services:
|
|||
- DRONE_HTTP_BIND=3003
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
garage:
|
||||
image: dxflrs/garage:v0.8.1
|
||||
container_name: garage
|
||||
network_mode: host
|
||||
restart: always
|
||||
volumes:
|
||||
- ./garage.toml:/etc/garage.toml
|
||||
|
||||
|
|
26
garage.toml
Normal file
26
garage.toml
Normal file
|
@ -0,0 +1,26 @@
|
|||
metadata_dir = "/var/lib/garage/meta"
|
||||
data_dir = "/var/lib/garage/data"
|
||||
db_engine = "lmdb"
|
||||
|
||||
replication_mode = "none"
|
||||
|
||||
rpc_bind_addr = "[::]:3901"
|
||||
rpc_public_addr = "127.0.0.1:3901"
|
||||
rpc_secret = "9ec6d97e54b2a55e939f0ba761ba565595691f0d42eb6511f4cb6cb69e906cad"
|
||||
|
||||
[s3_api]
|
||||
s3_region = "garage"
|
||||
api_bind_addr = "[::]:3900"
|
||||
root_domain = ".s3.localhost"
|
||||
|
||||
[s3_web]
|
||||
bind_addr = "[::]:3902"
|
||||
root_domain = ".web.localhost"
|
||||
index = "index.html"
|
||||
|
||||
[k2v_api]
|
||||
api_bind_addr = "[::]:3904"
|
||||
|
||||
[admin]
|
||||
api_bind_addr = "0.0.0.0:3903"
|
||||
admin_token = "vRbXiYk1SXEp6Ic9x3bx39WyZtPapDZWngSjgX1pgPQ="
|
Loading…
Reference in a new issue