diff --git a/Makefile b/Makefile index 5289a62..6857105 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,6 @@ psql: -e PGPASSWORD=postgres \ postgres psql -h postgres -U postgres sourcesdb -# Create tables -.PHONY: tables -tables: - java -jar codesearch-core.jar -i # Destroy Postgres .PHONY: db-kill diff --git a/README.md b/README.md index a6bc2fd..4fc5536 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ Docker installed, you can do this: $ make build # Build the project $ make db # Download and start Postgres (wait a bit after this step) - $ make tables # Create tables $ make serve # Run the server If you head to now, you should see the project @@ -39,8 +38,8 @@ running. The port can be changed: $ make serve port=7000 -Note: if you get an error at the `make tables` stage, you probably haven't -waited enough. Do `make db-kill` and start from `make db` again. +Note: if you get an error at the `make serve` stage, you probably haven't +waited enough. Do `make db-kill` and start from `make serve` again. ### Indexing packages diff --git a/core/src/main/scala/codesearch/core/CLI.scala b/core/src/main/scala/codesearch/core/CLI.scala index b2d2354..28e12e8 100644 --- a/core/src/main/scala/codesearch/core/CLI.scala +++ b/core/src/main/scala/codesearch/core/CLI.scala @@ -17,10 +17,6 @@ object CLI { c.copy(downloadMeta = true) } text "update package meta information" - opt[Unit]('i', "init-database") action { (_, c) => - c.copy(initDB = true) - } text "create tables for database" - opt[Unit]('b', "build-index") action { (_, c) => c.copy(buildIndex = true) } text "build index with only latest packages" diff --git a/core/src/main/scala/codesearch/core/Main.scala b/core/src/main/scala/codesearch/core/Main.scala index 576103c..968e2eb 100644 --- a/core/src/main/scala/codesearch/core/Main.scala +++ b/core/src/main/scala/codesearch/core/Main.scala @@ -16,7 +16,6 @@ object Main extends IOApp { final case class Params( updatePackages: Boolean = false, downloadMeta: Boolean = false, - initDB: Boolean = false, buildIndex: Boolean = false, limitedCountPackages: Option[Int] = None, lang: String = "all" diff --git a/core/src/main/scala/codesearch/core/Program.scala b/core/src/main/scala/codesearch/core/Program.scala index 514191a..b635a90 100644 --- a/core/src/main/scala/codesearch/core/Program.scala +++ b/core/src/main/scala/codesearch/core/Program.scala @@ -20,7 +20,7 @@ class Program(langReps: Map[String, LangRep[_ <: DefaultTable]], logger: Logger[ logger.info(s"Codesearch-core started for language ${params.lang}") } - _ <- initDb(params).whenA(params.initDB) + _ <- initDb(params) _ <- downloadMeta(params).whenA(params.downloadMeta) _ <- updatePackages(params).whenA(params.updatePackages) _ <- buildIndex(params).whenA(params.buildIndex) diff --git a/docker/README.MD b/docker/README.MD index 928c461..0c804b6 100644 --- a/docker/README.MD +++ b/docker/README.MD @@ -23,14 +23,6 @@ docker run -d -p 5432:5432 \ --name codesearch-db postgres ``` -# Create tables - -``` -docker run -d \ - --link codesearch-db:postgres \ - quay.io/aelve/codesearch-core make tables -``` - # Download packages meta-information (e.g. Haskell) ``` @@ -86,14 +78,11 @@ docker run -p 80:80 -d \ -e JAVA_OPTS="-Dplay.filters.hosts.allowed.1=codesearch.aelve.com -Dplay.filters.hosts.allowed.2=cloud.digitalocean.com"\ quay.io/aelve/codesearch-web-server make serve ``` -# Start the core service with all tasks (tables, download, update, index) for all languages via docker-compose +# Start the core service with all tasks (tables, download, update, index), server and database services for all languages via docker swarm ``` -docker-compose -f docker-compose-core up -d -``` - -# Start the server and database services via docker-compose +mkdir ./{portainer/data,postgresql,data,index,logs}` +docker stack deploy —with-registry-auth -c docker-stack-compose.yml codesearch ``` -docker-compose -f docker-compose-server up -d -``` \ No newline at end of file + diff --git a/docker/core/Makefile b/docker/core/Makefile index 5f8831f..0746a33 100644 --- a/docker/core/Makefile +++ b/docker/core/Makefile @@ -1,8 +1,3 @@ -# Create tables -.PHONY: tables -tables: - java -Dconfig.resource=production.conf -jar codesearch-core.jar -i - # Download package index. Acceptable values: {haskell, rust, ruby, javascript} download-%: java -Dconfig.resource=production.conf -jar codesearch-core.jar -d -l "$*" diff --git a/docker/docker-stack-compose.yml b/docker/docker-stack-compose.yml index babb295..851fb26 100644 --- a/docker/docker-stack-compose.yml +++ b/docker/docker-stack-compose.yml @@ -46,8 +46,7 @@ services: - /mnt/vol/index:/index - /mnt/vol/logs:/logs command: > - sh -c "./wait-for postgres:5432 -- make tables && \ - make download-haskell update-haskell index-haskell && \ + sh -c "./wait-for codesearch_postgres:5432 -- make download-haskell update-haskell index-haskell && \ make download-rust update-rust index-rust && \ make download-ruby update-ruby index-ruby" networks: