Added: Tandoor for recipes
This commit is contained in:
parent
4cfffeaebd
commit
77d5fa8eda
7
tandoor/files/.env
Normal file
7
tandoor/files/.env
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
SECRET_KEY=7ukvcoUnuyhPK6Nds3KbwG+3zeYuJGTDyi0ohFJqMwgjrdwBxn%
|
||||||
|
DB_ENGINE=django.db.backends.postgresql
|
||||||
|
POSTGRES_HOST=db
|
||||||
|
POSTGRES_PORT=5432
|
||||||
|
POSTGRES_USER=postgres
|
||||||
|
POSTGRES_PASSWORD=123456
|
||||||
|
POSTGRES_DB=tandoor
|
13
tandoor/files/nginx.conf.j2
Normal file
13
tandoor/files/nginx.conf.j2
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
server {
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
server_name {{ http_host }};
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:8880;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
73
tandoor/playbook.yml
Executable file
73
tandoor/playbook.yml
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
#################################################
|
||||||
|
# DO Community Playbooks: Docker
|
||||||
|
#################################################
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: true
|
||||||
|
vars_files:
|
||||||
|
- vars/default.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Pull Tandoor.dev image
|
||||||
|
docker_image:
|
||||||
|
name: "{{ image_name }}"
|
||||||
|
source: pull
|
||||||
|
state: present
|
||||||
|
force_source: yes
|
||||||
|
|
||||||
|
- name: Ensure Host Directory exists
|
||||||
|
file:
|
||||||
|
path: "/var/lib/{{ host_directory }}"
|
||||||
|
state: directory
|
||||||
|
group: www-data
|
||||||
|
owner: www-data
|
||||||
|
mode: 0655
|
||||||
|
|
||||||
|
- name: Upload the .env file
|
||||||
|
template:
|
||||||
|
src: "files/.env"
|
||||||
|
dest: "/var/lib/{{ host_directory }}/.env"
|
||||||
|
|
||||||
|
- name: Create Tandoor.dev container
|
||||||
|
docker_container:
|
||||||
|
name: "{{ container_name }}"
|
||||||
|
image: "{{ image_name }}"
|
||||||
|
state: started
|
||||||
|
restart_policy: "unless-stopped"
|
||||||
|
env_file: "/var/lib/{{ host_directory }}/.env"
|
||||||
|
links:
|
||||||
|
- "postgres:db"
|
||||||
|
published_ports:
|
||||||
|
- "127.0.0.1:8880:8080"
|
||||||
|
volumes:
|
||||||
|
- "/var/lib/{{ host_directory }}/staticfiles:/opt/recipes/staticfiles"
|
||||||
|
- "/var/lib/{{ host_directory }}/mediafiles:/opt/recipes/mediafiles"
|
||||||
|
- "/var/lib/{{ host_directory }}/externalfiles:/opt/recipes/externalfiles"
|
||||||
|
|
||||||
|
- name: Check if Nginx conf file exists
|
||||||
|
stat: path="/etc/nginx/sites-available/{{ http_conf }}"
|
||||||
|
register: status
|
||||||
|
|
||||||
|
- name: No need to reload Nginx
|
||||||
|
debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }}
|
||||||
|
|
||||||
|
- name: Set Nginx conf file
|
||||||
|
when: status.stat.exists == false
|
||||||
|
template:
|
||||||
|
src: "files/nginx.conf.j2"
|
||||||
|
dest: "/etc/nginx/sites-available/{{ http_conf }}"
|
||||||
|
|
||||||
|
- name: Enable new site
|
||||||
|
when: status.stat.exists == false
|
||||||
|
file:
|
||||||
|
src: "/etc/nginx/sites-available/{{ http_conf }}"
|
||||||
|
dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
|
||||||
|
state: link
|
||||||
|
notify: Reload Nginx
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: Reload Nginx
|
||||||
|
service:
|
||||||
|
name: nginx
|
||||||
|
state: reloaded
|
||||||
|
|
45
tandoor/readme.md
Normal file
45
tandoor/readme.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Gitea on Ubuntu
|
||||||
|
|
||||||
|
This playbook will install Gitea on an Ubuntu 19.10 machine.
|
||||||
|
A number of containers will be created with the options specified in the `vars/default.yml` variable file.
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
- `create_containers`: number of containers to create.
|
||||||
|
- `default_container_name`: default name for new containers.
|
||||||
|
- `default_container_image`: default image for new containers.
|
||||||
|
- `default_container_command`: default command to run on new containers.
|
||||||
|
|
||||||
|
|
||||||
|
## Running this Playbook
|
||||||
|
|
||||||
|
Quick Steps:
|
||||||
|
|
||||||
|
### 1. Obtain the playbook
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/do-community/ansible-playbooks.git
|
||||||
|
cd ansible-playbooks/docker_ubuntu1804
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Customize Options
|
||||||
|
|
||||||
|
```shell
|
||||||
|
nano vars/default.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
```yml
|
||||||
|
#vars/default.yml
|
||||||
|
---
|
||||||
|
create_containers: 4
|
||||||
|
default_container_name: docker
|
||||||
|
default_container_image: ubuntu
|
||||||
|
default_container_command: sleep 1d
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Run the Playbook
|
||||||
|
|
||||||
|
```command
|
||||||
|
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information on how to run this Ansible setup, please check this guide: [How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).
|
9
tandoor/vars/default.yml
Normal file
9
tandoor/vars/default.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
http_host: "recipes.tanshu.com"
|
||||||
|
http_conf: "recipes.tanshu.com.conf"
|
||||||
|
http_url: "https://recipes.tanshu.com"
|
||||||
|
|
||||||
|
container_name: tandoor
|
||||||
|
image_name: vabene1111/recipes:latest
|
||||||
|
|
||||||
|
host_directory: tandoor
|
Loading…
Reference in New Issue
Block a user