Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jeremie TISSERAND
couchbase
Commits
fc53014b
Commit
fc53014b
authored
May 07, 2018
by
Jeremie TISSERAND
Browse files
Remove extra revision creation (remove gateway option)
parent
b49fa5dd
Changes
5
Hide whitespace changes
Inline
Side-by-side
docker-compose.yml
View file @
fc53014b
...
...
@@ -12,6 +12,7 @@ services:
-
-c
-
"
echo
'Launching
couchbase'
&&
/usr/sbin/runsvdir-start
&
(
ok=1;
\
while
[
$$ok
!=
0
];
do
\
...
...
@@ -21,6 +22,7 @@ services:
ok=$$?;
\
done
)
&&
(
echo
'Configuring
Couchbase'
&&
echo
'Creating
cluster'
&&
...
...
@@ -30,6 +32,7 @@ services:
echo
'Creating
a
user
to
give
the
gateway
an
access
to
the
bucket'
&&
couchbase-cli
user-manage
-c
127.0.0.1
-u
${COUCHBASE_ADMIN_USER}
-p
${COUCHBASE_ADMIN_PWD}
--set
--rbac-username
${SECURITY_USER}
--rbac-password
${SECURITY_PWD}
--roles
admin
--auth-domain
local
)
&&
echo
'Initialization
done'
&&
tail
-f
/opt/couchbase/var/lib/couchbase/logs/error.log"
couchbase-gateway
:
...
...
@@ -45,6 +48,7 @@ services:
sleep
5
&&
echo
'Creating
configuration
file'
&&
COUCHBASE=$$(ping
couchbase-couchbase
-c
1
|
grep
-m
1
-E
-o
'[[:digit:]]+
\\
.[[:digit:]]+
\\
.[[:digit:]]+
\\
.[[:digit:]]+')
&&
echo
'
{
\"
adminInterface
\"
:
\"
0.0.0.0:4985
\"
,
...
...
@@ -58,10 +62,9 @@ services:
\"
bucket
\"
:
\"
${BUCKET_NAME}
\"
,
\"
username
\"
:
\"
${SECURITY_USER}
\"
,
\"
password
\"
:
\"
${SECURITY_PWD}
\"
,
\"
enable_shared_bucket_access
\"
:
true,
\"
import_docs
\"
:
\"
continuous
\"
,
\"
users
\"
:
{
\"
admin
\"
:
{
\"
password
\"
:
\"
adminadmin
\"
,
\"
admin_channels
\"
:
[
\"
*
\"
]}
\"
admin
\"
:
{
\"
password
\"
:
\"
adminadmin
\"
,
\"
admin_channels
\"
:
[
\"
*
\"
]},
\"
test
\"
:
{
\"
password
\"
:
\"
test
\"
,
\"
admin_channels
\"
:
[
\"
CHANNEL_test
\"
]}
},
\"
sync
\"
:
`
function(doc,
oldDoc)
{
...
...
@@ -70,7 +73,6 @@ services:
}
}
`
}
}
}
...
...
src/main/java/com/ippon/article/couchbase/server/article/ArticleController.java
View file @
fc53014b
package
com.ippon.article.couchbase.server.article
;
import
com.couchbase.client.deps.io.netty.handler.codec.http.HttpResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Set
;
@RestController
public
class
ArticleController
{
private
ArticleRepository
repository
;
public
ArticleController
(
ArticleRepository
repository
){
public
ArticleController
(
ArticleRepository
repository
)
{
this
.
repository
=
repository
;
}
...
...
src/main/java/com/ippon/article/couchbase/server/article/ArticleRepository.java
View file @
fc53014b
package
com.ippon.article.couchbase.server.article
;
import
org.springframework.data.couchbase.core.query.Query
;
import
org.springframework.data.couchbase.repository.CouchbaseRepository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
ArticleRepository
extends
CouchbaseRepository
<
Article
,
String
>
{
}
src/main/java/com/ippon/article/couchbase/server/config/CouchbaseConfiguration.java
View file @
fc53014b
package
com.ippon.article.couchbase.server.config
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration
;
import
org.springframework.data.couchbase.core.convert.CustomConversions
;
import
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter
;
import
org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories
;
import
javax.annotation.PostConstruct
;
import
java.util.Collections
;
import
java.util.List
;
@Configuration
@EnableCouchbaseRepositories
(
basePackages
=
{
"com.ippon.article"
})
@EnableCouchbaseRepositories
(
basePackages
=
{
"com.ippon.article"
})
public
class
CouchbaseConfiguration
extends
AbstractCouchbaseConfiguration
{
CouchbaseProperties
couchbaseProperties
;
...
...
src/main/resources/static/index.html
View file @
fc53014b
...
...
@@ -4,7 +4,13 @@
<title>
Test
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
integrity=
"sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
crossorigin=
"anonymous"
>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity=
"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"
integrity=
"sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T"
crossorigin=
"anonymous"
></script>
</head>
<body>
<script>
...
...
@@ -32,26 +38,22 @@ function ajouterArticle() {
</nav>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<form
id=
"add-article"
>
<h2>
Ajouter un article
</h2>
<div
class=
"row"
>
<span>
Code
</span>
<input
id=
"code"
type=
"text"
>
</div>
<div
class=
"row"
>
<span>
Tag
</span>
<input
id=
"tag"
type=
"text"
>
</div>
<div
class=
"row"
>
<span>
Contenu
</span>
<input
id=
"content"
type=
"textarea"
>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
onclick=
"ajouterArticle()"
>
Ajouter
</button>
</form>
<form
id=
"add-article"
>
<h2>
Ajouter un article
</h2>
<div
class=
"row"
>
<span
class=
"col-md-3"
>
Code
</span>
<input
class=
"col-md-3"
id=
"code"
type=
"text"
>
</div>
<div
class=
"row"
>
<span
class=
"col-md-3"
>
Tag
</span>
<input
class=
"col-md-3"
id=
"tag"
type=
"text"
>
</div>
<div
class=
"row"
>
<span
class=
"col-md-3"
>
Contenu
</span>
<input
class=
"col-md-3"
id=
"content"
type=
"textarea"
>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
onclick=
"ajouterArticle()"
>
Ajouter
</button>
</form>
</div>
...
...
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