Code Monkey home page Code Monkey logo

juju-charm-ghost's Introduction

Overview

Ghost is an Open Source application which allows you to write and publish your own blog, giving you the tools to make it easy and even fun to do. It's simple, elegant, and designed so that you can spend less time making your blog work and more time blogging.

This is an updated charm originally written by Jeff Pihach and ported over to the charms.reactive framework.

Quick Start

After you have a Juju cloud environment running:

$ juju deploy ghost
$ juju expose ghost

To access your newly installed blog you'll need to get the IP of the instance.

$ juju status ghost

Visit <your URL>:2368/ghost/ to create your username and password. Continue setting up Ghost by following the usage documentation.

You will want to change the URL that Ghost uses to generate links internally to the URL you will be using for your blog.

$ juju set ghost url=<your url>

Configuration

To view the configuration options for this charm open the config.yaml file or:

$ juju get ghost

To set a configuration option for this charm:

$ juju set ghost <key>=<value>

See the config.yaml file in the charm for a detailed list of all of the charms configuration options.

Setting Up Email Service

Ghost needs the ability to send emails to users for things like new user validation and password resets. To accomplish this Ghost supports using a third party email service which it can communicate with to send these emails. Ghost, and this charm, supports sending emails using Mailgun, Amazon SES, and Gmail. Additional information about why Ghost needs this service and it's supported platforms see Mail configuration.

To specify a supported email service to use you simply need to set the configuration values in the charm and they will be generated for your Ghost instance.

Mailgun & Gmail

$ juju set ghost mailserver_username=<your username>
$ juju set ghost mailserver_password=<your password>
Then
$ juju set ghost mail_service=Mailgun
-or-
$ juju set ghost mail_service=Gmail

Amazon SES

$ juju set ghost mailserver_username=<your username>
$ juju set ghost mailserver_password=<your password>
$ juju set ghost amazon_ses_host=<your ses host>
Then
$ juju set ghost mail_service=SES

After this has been completed your Ghost server will restart and Ghost will now be able to send emails using that provider. It's recommended to test this before you need it by creating a new user and pointing it to an email you control and ensure that you get the validation email.

Connecting To MySQL

By default this charm uses Ghost's built in SQLite storage. If you would like to horizontally scale your ghost instance you will need to use an external database like MySQL.

If you already have blog posts in the SQLite database they will not be deleted, but you will have to manually port them over to the MySQL database.

First you will need to deploy MySQL into your Juju environment:

$ juju deploy mysql

Additional details about the MySQL charm and configuration can be found in the MySQL charm details page.

You'll then need to relate the Ghost blog service to the MySQL service.

$ juju add-relation ghost mysql

The charm will then handle setting up all configuration options necessary to use the MySQL database instead of the internal SQLite database.

Load Balancing

$ juju deploy haproxy
$ juju expose haproxy
$ juju unexpose ghost
$ juju add-relation ghost haproxy

Contributing

Original charm

This charm is ported over from the original excellent charm @ ghost-charm repository

Current charm updated for latest LTS and using charms.reactive

juju-charm-ghost

Bug Reports

Please file bugs for the Ghost blogging engine in the TryGhost Ghost repository and not in the ghost-charm repository.

If you have found a bug with the ghost-charm itself they can be filed in the juju-charm-ghost repository. Please include exact steps to reproduce the issue and be as detailed as possible, including what version of Ubuntu you're running on, the version of this charm you have deployed, the cloud your environment is running on, any other charms deployed to the environment.

juju-charm-ghost's People

Contributors

johnsca avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

johnsca

juju-charm-ghost's Issues

if resource can't be found, download_archive gives confusing error

https://github.com/battlemidget/juju-charm-ghost/blob/master/lib/charms/layer/ghost.py#L36 - here, ghost_source can be "False" if hookenv.resource_get fails to find the resource.
In that case you get this traceback instead of a nice message about not finding the resource:

unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached error: could not download resource: HTTP request failed: resource#ghost/ghost-stable not found
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached Traceback (most recent call last):
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "/var/lib/juju/agents/unit-ghost-0/charm/hooks/app-storage-attached", line 19, in <module>
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     main()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "/usr/local/lib/python3.5/dist-packages/charms/reactive/__init__.py", line 78, in main
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     bus.dispatch()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 434, in dispatch
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     _invoke(other_handlers)
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 417, in _invoke
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     handler.invoke()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 291, in invoke
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     self._action(*args)
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "/var/lib/juju/agents/unit-ghost-0/charm/reactive/ghost.py", line 50, in check_app_config
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     ghost.update_ghost()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "lib/charms/layer/ghost.py", line 57, in update_ghost
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     download_archive()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached   File "lib/charms/layer/ghost.py", line 37, in download_archive
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached     hookenv.log("Extracting Ghost: {}".format(' '.join(cmd)))
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached TypeError: sequence item 2: expected str instance, bool found
unit-ghost-0: 16:56:57 ERROR juju.worker.uniter.operation hook "app-storage-attached" failed: exit status 1

Updating the charm icon

Hi,

The design team at Canonical would like to update charm icons to fit within the new circular format, as displayed in the current GUI.

This will improve how charms are displayed in the store, search results and on charm details pages.

I've attached a new version of the charm icon. If you're happy with this change, please could you update the icon and let us know when it's done.

ghost.svg.zip

Thanks

hook failed: "storage-attached"

I built the latest from:
https://github.com/battlemidget/charm-layer-ghost
https://github.com/battlemidget/juju-layer-node

deployed with juju-1:

$ juju-1 version
1.25.5-xenial-amd64

On local provider I get the following:

$ juju-1 status --format=tabular
[Services]   
NAME         STATUS EXPOSED CHARM                
ghost        error  false   local:xenial/ghost-0 
ghost-trusty error  false   local:trusty/ghost-0 

[Units]        
ID             WORKLOAD-STATE AGENT-STATE VERSION  MACHINE PORTS PUBLIC-ADDRESS MESSAGE                         
ghost-trusty/0 error          idle        1.25.5.1 2             10.0.3.94      hook failed: "storage-attached" 
ghost/0        error          idle        1.25.5.1 1             10.0.3.64      hook failed: "storage-attached" 

[Machines] 
ID         STATE   VERSION  DNS       INS-ID                   SERIES HARDWARE   
0          started 1.25.5.1 localhost localhost                xenial            
1          started 1.25.5.1 10.0.3.64 arosales-local-machine-1 xenial arch=amd64 
2          started 1.25.5.1 10.0.3.94 arosales-local-machine-2 trusty arch=amd64 

Error in question is:

2016-06-27 23:35:23 INFO app-storage-attached Successfully installed Jinja2-2.8 MarkupSafe-0.23 PyYAML-3.11 Tempita-0.5.2 charmhelpers-0.7.0 charms.reactive-0.4.4 netaddr-0.7.18 pip-8.1.2 pyaml-15.8.2 shell-1.0.1 six-1.10.0 toml-0.9.1
2016-06-27 23:35:23 INFO juju-log Reactive main running for hook app-storage-attached
2016-06-27 23:35:23 INFO app-storage-attached Traceback (most recent call last):
2016-06-27 23:35:23 INFO app-storage-attached   File "/var/lib/juju/agents/unit-ghost-trusty-0/charm/hooks/app-storage-attached", line 19, in <module>
2016-06-27 23:35:23 INFO app-storage-attached     main()
2016-06-27 23:35:23 INFO app-storage-attached   File "/usr/local/lib/python3.4/dist-packages/charms/reactive/__init__.py", line 76, in main
2016-06-27 23:35:23 INFO app-storage-attached     bus.discover()
2016-06-27 23:35:23 INFO app-storage-attached   File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 458, in discover
2016-06-27 23:35:23 INFO app-storage-attached     _register_handlers_from_file(filepath)
2016-06-27 23:35:23 INFO app-storage-attached   File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 484, in _register_handlers_from_file
2016-06-27 23:35:23 INFO app-storage-attached     _load_module(filepath)
2016-06-27 23:35:23 INFO app-storage-attached   File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 471, in _load_module
2016-06-27 23:35:23 INFO app-storage-attached     sys.modules[modname] = load_source(modname, realpath)
2016-06-27 23:35:23 INFO app-storage-attached   File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 35, in load_source
2016-06-27 23:35:23 INFO app-storage-attached     return SourceFileLoader(modname, realpath).load_module()
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 1614, in load_module
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 596, in _load_module_shim
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 1220, in load
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 1129, in _exec
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 1471, in exec_module
2016-06-27 23:35:23 INFO app-storage-attached   File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
2016-06-27 23:35:23 INFO app-storage-attached   File "/var/lib/juju/agents/unit-ghost-trusty-0/charm/reactive/ghost.py", line 14, in <module>
2016-06-27 23:35:23 INFO app-storage-attached     from nodejs import node_dist_dir, npm
2016-06-27 23:35:23 INFO app-storage-attached ImportError: No module named 'nodejs'
2016-06-27 23:35:23 ERROR juju.worker.uniter.operation runhook.go:107 hook "app-storage-attached" failed: exit status 1

ghost/reactive/ghost.py

  1 import os
  2 import sys
  3 from charms.reactive import (
  4     hook,
  5     when,
  6     only_once,
  7     is_state
  8 )
  9 
 10 from charmhelpers.core import hookenv, host
 11 from charmhelpers.core.templating import render
 12 
 13 # ./lib/nodejs.py
 14 from nodejs import node_dist_dir, npm

I did some Google'ing for import on nodejs, but didn't come up with anything trival. This also fails from the python interpreter:

$ python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29) 
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from nodejs import node_dist_dir, npm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named nodejs
>>> from node import node_dist_dir, npm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named node

At this point I thought I would log an issue and seek assistance from folks a lot more knowledgeable than myself. The issue is most likely pilot error, thus apologies and advance.

Full unit logs attached:
unit-ghost-trusty-0.log.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.