refstack: create database storage area

The mariadb container currently doesn't persist it's database
anywhere.  Map /var/lib/refstack/db to /var/lib/mysql in the
container.

We have /var/refstack and /var/lib/refstack with various things.
While we're here move everythign under /var/lib/refstack.

Also use 127.0.0.1 to ensure mysql doesn't try to connect over a
socket, but tcp (I think pymsql does anyway, but it's a little
clearer).

Change-Id: I5605eac2848a6b2222698bf20c707baa4442fcd5
This commit is contained in:
Ian Wienand 2021-02-10 17:31:46 +11:00
parent 0f9d47a87c
commit a246df66b4
3 changed files with 31 additions and 10 deletions

View File

@ -38,6 +38,22 @@
mode: 0644
notify: refstack Reload apache2
- name: Create refstack storage
file:
state: directory
path: /var/lib/refstack/
owner: root
group: root
mode: 0755
- name: Create refstack config storage area
file:
state: directory
path: /var/lib/refstack/etc
owner: root
group: root
mode: 0755
- name: Create refstack data storage area
file:
state: directory
@ -54,25 +70,28 @@
group: root
mode: 0755
- name: Create refstack db storage area
file:
state: directory
path: /var/lib/refstack/db
owner: root
group: root
mode: 0755
- name: Copy hound robots.txt
copy:
src: robots.txt
dest: /var/lib/refstack/www/robots.txt
- name: Ensure refstack volume directory exists
file:
state: directory
path: "/var/refstack"
- name: Write refstack.conf
template:
src: refstack.conf.j2
dest: /var/refstack/refstack.conf
dest: /var/lib/refstack/etc/refstack.conf
- name: Write config.json
template:
src: config.json.j2
dest: /var/refstack/config.json
dest: /var/lib/refstack/etc/config.json
- name: Install distro packages
package:

View File

@ -12,6 +12,8 @@ services:
MYSQL_DATABASE: refstack
MYSQL_USER: "{{ refstack_db_username }}"
MYSQL_PASSWORD: "{{ refstack_db_password }}"
volumes:
- /var/lib/refstack/db:/var/lib/mysql
refstack-api:
depends_on:
- mariadb
@ -19,6 +21,6 @@ services:
network_mode: host
restart: always
volumes:
- /var/refstack/refstack.conf:/etc/refstack.conf
- /var/refstack/config.json:/refstack-ui/app/config.json
- /var/lib/refstack/etc/refstack.conf:/etc/refstack.conf
- /var/lib/refstack/etc/config.json:/refstack-ui/app/config.json
- /var/lib/refstack/data:/var/run/data

View File

@ -11,7 +11,7 @@ api_url = {{ refstack_url }}
enable_anonymous_upload = {{ enable_anonymous_upload | default(false) }}
[database]
connection = "mysql+pymysql://{{ refstack_db_username}}:{{ refstack_db_password }}@localhost/refstack?charset=utf8"
connection = "mysql+pymysql://{{ refstack_db_username}}:{{ refstack_db_password }}@127.0.0.1/refstack?charset=utf8"
[osid]
openstack_openid_endpoint = {{ refstack_openid_endpoint }}