diff --git a/ansible/hosts b/ansible/hosts index 0220cec..9539e75 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -1,2 +1,2 @@ [lsio] -lsio +138.68.135.42 ansible_connection=ssh ansible_user=root ansible_python_interpreter=/usr/bin/python diff --git a/ansible/main.yml b/ansible/main.yml index 0fb489a..e62b3c5 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -8,6 +8,7 @@ - common - docker - lsiousers + - lsiosite #- ssh #- docker #- lsiosite diff --git a/ansible/roles/lsiosite/files/opt/ghost/config.js b/ansible/roles/lsiosite/files/opt/ghost/config.js new file mode 100644 index 0000000..fdf631c --- /dev/null +++ b/ansible/roles/lsiosite/files/opt/ghost/config.js @@ -0,0 +1,166 @@ +// # Ghost Configuration +// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments). + +// Ghost runs in `development` mode by default. Full documentation can be found at http://support.ghost.org/config/ + +var path = require('path'), + config; + +config = { + // ### Production + // When running Ghost in the wild, use the production environment. + // Configure your URL and mail settings here + production: { + url: 'https://www.linuxserver.io', + mail: { + transport: 'SMTP', + from: '"LinuxServer Team" ', + options: { + service: 'Mailgun', + auth: { + user: 'postmaster@linuxserver.io', + pass: '8ccd8fa5e04f6a85421a6cce0b4d5229' + } + } + }, + database: { + client: 'sqlite3', + connection: { + filename: path.join(process.env.GHOST_CONTENT, '/data/ghost.db') + }, + debug: false + }, + + server: { + host: '0.0.0.0', + port: '2368' + }, + paths: { + contentPath: path.join(process.env.GHOST_CONTENT, '/') + } + + }, + + // ### Development **(default)** + development: { + // The url to use when providing links to the site, E.g. in RSS and email. + // Change this to your Ghost blog's published URL. + url: 'http://dev.linuxserver.io', + + // Example refferer policy + // Visit https://www.w3.org/TR/referrer-policy/ for instructions + // default 'origin-when-cross-origin', + // referrerPolicy: 'origin-when-cross-origin', + + // Example mail config + // Visit http://support.ghost.org/mail for instructions + // ``` + // mail: { + // transport: 'SMTP', + // options: { + // service: 'Mailgun', + // auth: { + // user: '', // mailgun username + // pass: '' // mailgun password + // } + // } + // }, + // ``` + + // #### Database + // Ghost supports sqlite3 (default), MySQL & PostgreSQL + database: { + client: 'sqlite3', + connection: { + filename: path.join(process.env.GHOST_CONTENT, '/data/ghost-dev.db') + }, + debug: false + }, + // #### Server + // Can be host & port (default), or socket + server: { + // Host to be passed to node's `net.Server#listen()` + host: '0.0.0.0', + // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT` + port: '2368' + }, + // #### Paths + // Specify where your content directory lives + paths: { + contentPath: path.join(process.env.GHOST_CONTENT, '/') + } + }, + + // **Developers only need to edit below here** + + // ### Testing + // Used when developing Ghost to run tests and check the health of Ghost + // Uses a different port number + testing: { + url: 'http://0.0.0.0:2369', + database: { + client: 'sqlite3', + connection: { + filename: path.join(process.env.GHOST_CONTENT, '/data/ghost-test.db') + }, + pool: { + afterCreate: function (conn, done) { + conn.run('PRAGMA synchronous=OFF;' + + 'PRAGMA journal_mode=MEMORY;' + + 'PRAGMA locking_mode=EXCLUSIVE;' + + 'BEGIN EXCLUSIVE; COMMIT;', done); + } + }, + useNullAsDefault: true + }, + server: { + host: '0.0.0.0', + port: '2369' + }, + logging: false + }, + + // ### Testing MySQL + // Used by Travis - Automated testing run through GitHub + 'testing-mysql': { + url: 'http://0.0.0.0:2369', + database: { + client: 'mysql', + connection: { + host : '0.0.0.0', + user : 'root', + password : '', + database : 'ghost_testing', + charset : 'utf8' + } + }, + server: { + host: '0.0.0.0', + port: '2369' + }, + logging: false + }, + + // ### Testing pg + // Used by Travis - Automated testing run through GitHub + 'testing-pg': { + url: 'http://0.0.0.0:2369', + database: { + client: 'pg', + connection: { + host : '0.0.0.0', + user : 'postgres', + password : '', + database : 'ghost_testing', + charset : 'utf8' + } + }, + server: { + host: '0.0.0.0', + port: '2369' + }, + logging: false + } +}; + +module.exports = config; diff --git a/ansible/roles/lsiosite/tasks/main.yml b/ansible/roles/lsiosite/tasks/main.yml index 1d1b6e7..faa4f31 100644 --- a/ansible/roles/lsiosite/tasks/main.yml +++ b/ansible/roles/lsiosite/tasks/main.yml @@ -2,12 +2,29 @@ - name: install pre-reqs include: pre-reqs.yml +- name: ensure volume dir has correct permissions + file: + path: /opt/ghost + state: directory + recurse: yes + owner: lsio + group: root + mode: 0755 + +- name: copy config.js for ghost into place + copy: + src: opt/ghost/config.js + dest: /opt/ghost/config.js + owner: lsio + group: root + mode: 0644 + - name: setup lsio site ghost container docker_container: name: lsio_ghost image: ghost state: started - restart: always + restart_policy: always ports: - "80:2368" - "443:443" diff --git a/ansible/roles/lsiosite/tasks/pre-reqs.yml b/ansible/roles/lsiosite/tasks/pre-reqs.yml index 80359cd..9ef4319 100644 --- a/ansible/roles/lsiosite/tasks/pre-reqs.yml +++ b/ansible/roles/lsiosite/tasks/pre-reqs.yml @@ -2,9 +2,16 @@ - name: install packages apt: pkg={{ item }} state=present with_items: + - python3 + - python-dev + - python-pip - python-setuptools +- name: Make sure pip upgraded (fixes docker-py errors) + command: easy_install -U pip + - name: install docker-py - easy_install: + pip: name: docker-py - state: latest + state: present + extra_args: -U