Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

[#255] initDB set default to true #256

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ Docker installed, you can do this:

$ make build # Build the project
$ make db # Download and start Postgres (wait a bit after this step)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this step, roll it back, please.

$ make tables # Create tables
$ make serve # Run the server

If you head to <http://localhost:9000> now, you should see the project
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

Expand Down
4 changes: 0 additions & 4 deletions core/src/main/scala/codesearch/core/CLI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/codesearch/core/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/codesearch/core/Program.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions docker/core/Makefile
Original file line number Diff line number Diff line change
@@ -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 "$*"
Expand Down
3 changes: 1 addition & 2 deletions docker/docker-stack-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 postgres:5432 -- make download-haskell update-haskell index-haskell && \
make download-rust update-rust index-rust && \
make download-ruby update-ruby index-ruby"
networks:
Expand Down