Image Search Java API demo
CI status: https://circleci.com/gh/kenalib/image-search-java
export ACCESS_KEY_ID=XXXXXXXXXXXXXXXX
export ACCESS_KEY_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
INSTANCE_NAME
in src/main/resources/image-search.properties
CORS_URL
(default is *
)increment.meta
on your OSS bucketImageSearchOSSAccessRole
Reset
before OSS import to clear existing dataImported
mvn test
# this will create target/image-search-webapp.war
mvn package
# this will skip test
mvn package -DskipTests
mvn tomcat7:run
# GET returns default result
curl http://localhost:8080/image-search-webapp/search_picture | python -m json.tool
# POST from form
open http://localhost:8080/image-search-webapp/check.html
# Test
docker-compose -f docker-compose.test.yml run web mvn test
docker-compose up -d
docker-compose ps
docker-compose logs -f web
open http://localhost/image-search-webapp/search_picture
open http://localhost/image-search-webapp/check.html
# go into container for debug
docker exec -it image-search-webapp bash
Dockerfile
を編集した後は docker-compose up -d --build
docker-compose stop
docker-compose down # stop and remove
docker-compose ps
Quick deploy using docker machine
# this will create ~/go/bin/docker-machine-driver-aliyunecs
go get -u github.com/AliyunContainerService/docker-machine-driver-aliyunecs
export ECS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXX
export ECS_ACCESS_KEY_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
export ECS_REGION=ap-southeast-1
docker-machine create --driver aliyunecs image-search-webapp
docker-machine ls
# you should see a new virtual machine
docker-machine rm -f image-search-webapp
eval $(docker-machine env image-search-webapp)
docker-compose up -d
docker-compose ps
docker-compose logs -f web
IP=$(docker-machine ip image-search-webapp)
curl http://${IP}/image-search-webapp/search_picture | python -m json.tool
open http://${IP}/image-search-webapp/check.html
# ssh to the machine for debug
docker-machine ssh image-search-webapp
# go into container for debug
docker exec -it image-search-webapp bash
.circleci/config.yml
for auto deploy using docker-compose
# for image search
ACCESS_KEY_ID
ACCESS_KEY_SECRET
# c.f. docker-machine env image-search-webapp
DOCKER_TLS_VERIFY=1
DOCKER_CERT_PATH=.
DOCKER_HOST
# .pem files content
DOCKER_CA_PEM
DOCKER_CERT_PEM
DOCKER_KEY_PEM
docker-machine env image-search-webapp
to show actual variables.
cat ~/.docker/machine/machines/image-search-webapp/ca.pem | pbcopy
docker-compose stop
docker-compose down
eval $(docker-machine env -u)
docker-machine stop image-search-webapp
docker-machine rm image-search-webapp
docker-machine ssh image-search-webapp
apt-get update
lsb_release -a
apt list --installed | grep docker
apt-cache madison docker-ce
apt-get install docker-ce=18.03.1~ce-0~ubuntu