Added: wikijs
This commit is contained in:
parent
67750b459d
commit
ae6fde8113
6
wikijs/files/.env
Normal file
6
wikijs/files/.env
Normal file
@ -0,0 +1,6 @@
|
||||
DB_TYPE=postgres
|
||||
DB_NAME=hiwikijs
|
||||
DB_USER=postgres
|
||||
DB_PASS=123456
|
||||
DB_HOST=db
|
||||
DB_PORT=5432
|
13
wikijs/files/nginx.conf.j2
Normal file
13
wikijs/files/nginx.conf.j2
Normal file
@ -0,0 +1,13 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
server_name {{ http_host }};
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3443;
|
||||
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;
|
||||
}
|
||||
}
|
69
wikijs/playbook.yml
Executable file
69
wikijs/playbook.yml
Executable file
@ -0,0 +1,69 @@
|
||||
#################################################
|
||||
# DO Community Playbooks: Docker
|
||||
#################################################
|
||||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
vars_files:
|
||||
- vars/default.yml
|
||||
|
||||
tasks:
|
||||
- name: Pull Wiki.js 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 Wiki.js 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:3443:3000"
|
||||
|
||||
- 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
wikijs/readme.md
Normal file
45
wikijs/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
wikijs/vars/default.yml
Normal file
9
wikijs/vars/default.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
http_host: "wiki.hinchco.in"
|
||||
http_conf: "wiki.hinchco.in.conf"
|
||||
http_url: "https://wiki.hinchco.in"
|
||||
|
||||
container_name: wikijs
|
||||
image_name: ghcr.io/requarks/wiki:latest
|
||||
|
||||
host_directory: hiwikijs
|
Loading…
Reference in New Issue
Block a user