Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
be781bdb
Commit
be781bdb
authored
Nov 24, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tried postgres
parent
a8f915f0
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
76 additions
and
49 deletions
+76
-49
Dockerfile
+45
-0
conf/grafana.ini
+12
-1
install_dependencies.sh
+0
-2
pkg/middleware/middleware.go
+1
-1
pkg/routes/api/api_account.go
+3
-3
pkg/server/server.go
+0
-29
pkg/stores/sqlstore/sqlstore.go
+1
-1
pkg/stores/sqlstore/sqlstore_accounts.go
+6
-6
start_dependencies.sh
+8
-6
No files found.
Dockerfile
0 → 100644
View file @
be781bdb
FROM
ubuntu
# Add the PostgreSQL PGP key to verify their Debian packages.
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN
apt-key adv
--keyserver
keyserver.ubuntu.com
--recv-keys
B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
# Add PostgreSQL's repository. It contains the most recent stable release
# of PostgreSQL, ``9.3``.
RUN
echo
"deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main"
>
/etc/apt/sources.list.d/pgdg.list
# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3
# There are some warnings (in red) that show up during the build. You can hide
# them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive
RUN
apt-get update
&&
apt-get install
-y
python-software-properties software-properties-common postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
# Note: The official Debian and Ubuntu images automatically ``apt-get clean``
# after each ``apt-get``
# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed``
USER
postgres
# Create a PostgreSQL role named ``docker`` with ``docker`` as the password and
# then create a database `docker` owned by the ``docker`` role.
# Note: here we use ``&&\`` to run commands one after the other - the ``\``
# allows the RUN command to span multiple lines.
RUN
/etc/init.d/postgresql start
&&
\
psql
--command
"CREATE USER grafana WITH SUPERUSER PASSWORD 'grafana';"
&&
\
createdb
-O
grafana grafana
# Adjust PostgreSQL configuration so that remote connections to the
# database are possible.
RUN
echo
"host all all 0.0.0.0/0 md5"
>>
/etc/postgresql/9.3/main/pg_hba.conf
# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
RUN
echo
"listen_addresses='*'"
>>
/etc/postgresql/9.3/main/postgresql.conf
# Expose the PostgreSQL port
EXPOSE
5432
# Add VOLUMEs to allow backup of config, logs and databases
VOLUME
["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
# Set the default command to run when starting the container
CMD
["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"]
conf/grafana.ini
View file @
be781bdb
...
...
@@ -65,7 +65,18 @@ ssl_mode = disable
; For "sqlite3" only
path
=
data/grafana.db
; [database]
; ; Either "mysql", "postgres" or "sqlite3", it's your choice
; type = postgres
; host = 127.0.0.1:5432
; name = grafana
; user = grafana
; password = grafana
; ; For "postgres" only, either "disable", "require" or "verify-full"
; ssl_mode = disable
; ; For "sqlite3" only
; path = data/grafana.db
;
[log]
root_path
=
; Either "console", "file", "conn", "smtp" or "database", default is "console"
...
...
install_dependencies.sh
deleted
100644 → 0
View file @
a8f915f0
go get code.google.com/p/goprotobuf/
{
proto,protoc-gen-go
}
pkg/middleware/middleware.go
View file @
be781bdb
...
...
@@ -76,7 +76,7 @@ func (ctx *Context) JsonApiErr(status int, message string, err error) {
resp
[
"message"
]
=
message
}
ctx
.
HTML
(
status
,
"index"
)
ctx
.
JSON
(
status
,
resp
)
}
func
(
ctx
*
Context
)
JsonBody
(
model
interface
{})
bool
{
...
...
pkg/routes/api/api_account.go
View file @
be781bdb
...
...
@@ -40,12 +40,12 @@ func AddCollaborator(c *middleware.Context) {
accountToAdd
,
err
:=
models
.
GetAccountByLogin
(
model
.
Email
)
if
err
!=
nil
{
c
.
J
SON
(
404
,
utils
.
DynMap
{
"message"
:
"Collaborator not found"
}
)
c
.
J
sonApiErr
(
404
,
"Collaborator not found"
,
nil
)
return
}
if
accountToAdd
.
Id
==
c
.
UserAccount
.
Id
{
c
.
J
SON
(
400
,
utils
.
DynMap
{
"message"
:
"Cannot add yourself as collaborator"
}
)
c
.
J
sonApiErr
(
400
,
"Cannot add yourself as collaborator"
,
nil
)
return
}
...
...
@@ -53,7 +53,7 @@ func AddCollaborator(c *middleware.Context) {
err
=
models
.
AddCollaborator
(
collaborator
)
if
err
!=
nil
{
c
.
J
SON
(
400
,
utils
.
DynMap
{
"message"
:
err
.
Error
()}
)
c
.
J
sonApiErr
(
500
,
"Could not add collaborator"
,
err
)
return
}
...
...
pkg/server/server.go
deleted
100644 → 0
View file @
a8f915f0
package
server
import
(
"github.com/torkelo/grafana-pro/pkg/api"
"github.com/torkelo/grafana-pro/pkg/configuration"
"github.com/torkelo/grafana-pro/pkg/stores"
)
type
Server
struct
{
HttpServer
*
api
.
HttpServer
Store
stores
.
Store
}
func
NewServer
(
cfg
*
configuration
.
Cfg
)
(
*
Server
,
error
)
{
store
:=
stores
.
New
()
httpServer
:=
api
.
NewHttpServer
(
cfg
,
store
)
return
&
Server
{
HttpServer
:
httpServer
,
Store
:
store
,
},
nil
}
func
(
self
*
Server
)
ListenAndServe
()
error
{
self
.
HttpServer
.
ListenAndServe
()
return
nil
}
pkg/stores/sqlstore/sqlstore.go
View file @
be781bdb
...
...
@@ -50,7 +50,7 @@ func LoadModelsConfig() {
DbCfg
.
Name
=
setting
.
Cfg
.
MustValue
(
"database"
,
"name"
)
DbCfg
.
User
=
setting
.
Cfg
.
MustValue
(
"database"
,
"user"
)
if
len
(
DbCfg
.
Pwd
)
==
0
{
DbCfg
.
Pwd
=
setting
.
Cfg
.
MustValue
(
"database"
,
"passwd"
)
DbCfg
.
Pwd
=
setting
.
Cfg
.
MustValue
(
"database"
,
"passw
or
d"
)
}
DbCfg
.
SslMode
=
setting
.
Cfg
.
MustValue
(
"database"
,
"ssl_mode"
)
DbCfg
.
Path
=
setting
.
Cfg
.
MustValue
(
"database"
,
"path"
,
"data/grafana.db"
)
...
...
pkg/stores/sqlstore/sqlstore_accounts.go
View file @
be781bdb
...
...
@@ -61,9 +61,9 @@ func GetAccountByLogin(emailOrLogin string) (*models.Account, error) {
func
GetCollaboratorsForAccount
(
accountId
int64
)
([]
*
models
.
CollaboratorInfo
,
error
)
{
collaborators
:=
make
([]
*
models
.
CollaboratorInfo
,
0
)
sess
:=
x
.
Table
(
"
C
ollaborator"
)
sess
.
Join
(
"INNER"
,
"
Account"
,
"Account.id=C
ollaborator.account_Id"
)
sess
.
Where
(
"
C
ollaborator.for_account_id=?"
,
accountId
)
sess
:=
x
.
Table
(
"
c
ollaborator"
)
sess
.
Join
(
"INNER"
,
"
account"
,
"account.id=c
ollaborator.account_Id"
)
sess
.
Where
(
"
c
ollaborator.for_account_id=?"
,
accountId
)
err
:=
sess
.
Find
(
&
collaborators
)
return
collaborators
,
err
...
...
@@ -91,9 +91,9 @@ func AddCollaborator(collaborator *models.Collaborator) error {
func
GetOtherAccountsFor
(
accountId
int64
)
([]
*
models
.
OtherAccount
,
error
)
{
collaborators
:=
make
([]
*
models
.
OtherAccount
,
0
)
sess
:=
x
.
Table
(
"
C
ollaborator"
)
sess
.
Join
(
"INNER"
,
"
Account"
,
"Account.id=C
ollaborator.account_Id"
)
sess
.
Where
(
"
Collaborator.
account_id=?"
,
accountId
)
sess
:=
x
.
Table
(
"
c
ollaborator"
)
sess
.
Join
(
"INNER"
,
"
account"
,
"account.id=c
ollaborator.account_Id"
)
sess
.
Where
(
"account_id=?"
,
accountId
)
err
:=
sess
.
Find
(
&
collaborators
)
return
collaborators
,
err
}
start_dependencies.sh
View file @
be781bdb
docker
kill
rethinkdb
docker rm rethinkdb
docker build
-t
gf-pro-image
.
docker run
-d
-p
8180:8080
-p
28015:28015
-p
29015:29015
\
--name
rethinkdb
\
-v
/var/docker/grafana-pro-rethinkdb:/data
\
dockerfile/rethinkdb
docker
kill
gf-pro
docker rm gf-pro
docker run
-d
--name
=
"gf-pro"
\
-p
127.0.0.1:5432:5432
\
-v
/var/docker/grafana-pro/postgresql:/var/lib/postgres
\
gf-pro-image
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment