-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working MVP with full docker containers #6
- Loading branch information
Showing
2 changed files
with
59 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,63 @@ See also [History of Uwazi](https://github.com/huridocs/uwazi/wiki/History-of-Uw | |
The [uwazi-docker](https://github.com/fititnt/uwazi-docker) requires | ||
[docker-compose](https://docs.docker.com/compose/install/) installed. | ||
|
||
### Install | ||
Run these commands on your terminal: | ||
|
||
```bash | ||
git clone [email protected]:fititnt/uwazi-docker.git | ||
cd uwazi-docker | ||
docker-compose run -e IS_FIRST_RUN=true uwazi | ||
docker-compose run -e IS_FIRST_RUN=true --rm uwazi | ||
``` | ||
|
||
### Run | ||
|
||
```bash | ||
docker-compose up -d uwazi | ||
``` | ||
|
||
Open your browser at <http://localhost:3000/>. User: _admin_, password: _admin_. | ||
|
||
### Basic docker commands | ||
|
||
```bash | ||
# Stop all containers from this uwazi-docker and do not restart again until you explicit ask for it | ||
docker-compose stop | ||
|
||
# Using "-d" param to run uwazi and its dependencies on background | ||
docker-compose up -d uwazi | ||
|
||
# No "-d" param, start uwazi, MongoDB & Elastic Search and see what is happening inside the containers | ||
docker-compose up uwazi | ||
|
||
# See what containers are running now | ||
docker ps | ||
|
||
# Want some GUI to see what is happening on MongoDB? Use nosqlclient | ||
docker-compose up -d mongo-gui-mongoclient | ||
|
||
# Want some GUI to see what is happening on Elastic Search? Try Dejavu | ||
docker-compose up -d mongo-gui-mongoclient | ||
``` | ||
|
||
### Extra features | ||
|
||
#### Want some GUI to see what is happening on MongoDB? Use nosqlclient | ||
|
||
```bash | ||
docker-compose up -d mongo-gui-mongoclient | ||
``` | ||
|
||
By default, uses <http://localhost:51000/>. | ||
|
||
#### Want some GUI to see what is happening on Elastic Search? Try Dejavu | ||
|
||
```bash | ||
docker-compose up -d elasticsearch-gui-dejavu | ||
``` | ||
|
||
By default, uses <http://localhost:52000/>. | ||
|
||
### Customization | ||
Provably will be much easier lean a bit more about | ||
[Docker compose](https://docs.docker.com/compose/overview/) and use the | ||
|
@@ -47,19 +94,7 @@ all stack applications inside docker containers. One example is running | |
database storages directly on Virtual Machines (or even physical machines) | ||
on the production environment. | ||
|
||
### Debug | ||
|
||
_Ignore this part if you are not debugging uwazi-docker._ | ||
|
||
- Run Elastic Search, Mongo, and force rebuild the Dockerfile Uwazi: `docker-compose up --build` | ||
- Login on the running Uwazi container: `docker exec -it uwazidocker_uwazi_1 bash` | ||
- Run only Elastic Search and MongoDB (e.g. if you are running Uwazi without docker): `docker-compose up -d elasticsearch mongo` | ||
- GUI for ElasticSearch (Dejavu) on <http://localhost:51000/>: `docker-compose up -d elasticsearch-gui-dejavu` | ||
- GUI for MongoDB (nosqlclient) on <http://localhost:52000/>: `docker-compose up -d mongo-gui-mongoclient` | ||
- Run all with docker `docker-compose up uwazi` | ||
<!-- - Initialize databases (Run this first time): `docker-compose build` and then `docker-compose run -e IS_FIRST_RUN=true uwazi`--> | ||
<!-- - Run all with docker `docker-compose up uwazi --build` --> | ||
|
||
### Uninstall | ||
|
||
See [how to uninstall](uninstall.md). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
#!/bin/sh | ||
|
||
echo "IS_FIRST_RUN: $IS_FIRST_RUN" | ||
echo "uwazi-docker: IS_FIRST_RUN: $IS_FIRST_RUN" | ||
DB_INITIALIZATION_PATH=/home/node/uwazi/blank_state/uwazi_development | ||
|
||
if [ "$IS_FIRST_RUN" = "true" ] ; then | ||
echo "Enviroment variable IS_FIRST_RUN is true. Assuming need to install database from blank state" | ||
# echo "Sorry, this version of uwazi-docker is not ready to initialize using docker. You need to setup first time from your host before use this container" | ||
# echo "Sorry, this version of uwazi-docker is not fully ready to initialize using docker. You need to setup the MongoDB outside this container with yarn blank-state" | ||
|
||
# mongo --version | ||
# mongorestore --version | ||
# yarn blank-state | ||
|
||
echo "\n\nDeleting ${DBHOST:-mongo} ${DATABASE_NAME:-uwazi_development} MongoDB database" | ||
echo "uwazi-docker: Enviroment variable IS_FIRST_RUN is true. Assuming need to install database from blank state" | ||
|
||
echo "\n\nuwazi-docker: Deleting ${DBHOST:-mongo} ${DATABASE_NAME:-uwazi_development} MongoDB database" | ||
mongo -host ${DBHOST:-mongo} ${DATABASE_NAME:-uwazi_development} --eval "db.dropDatabase()" | ||
|
||
echo "\n\nImporting $DB_INITIALIZATION_PATH to ${DBHOST:-mongo} ${DATABASE_NAME:-uwazi_development} MongoDB database" | ||
|
||
echo "\n\nuwazi-docker: Importing $DB_INITIALIZATION_PATH to ${DBHOST:-mongo} ${DATABASE_NAME:-uwazi_development} MongoDB database" | ||
mongorestore -h ${DBHOST:-mongo} $DB_INITIALIZATION_PATH --db=${DATABASE_NAME:-uwazi_development} | ||
|
||
echo "Applyng yarn reindex. This will use data from MongoDB to feed Elastic Search" | ||
echo "uwazi-docker: Applyng yarn reindex. This will use data from MongoDB to feed Elastic Search" | ||
yarn reindex | ||
|
||
echo "uwazi-docker: If no fatal errors occurred, you will not need to use this command again" | ||
exit 0 | ||
else | ||
echo "Enviroment variable IS_FIRST_RUN is not true. Assume MongoDB and Elastic Search provide already are intialized" | ||
echo "If this is the first time and you want this container also initialize MongoDB and Elastic Search, run only ONE, and just ONE time, with variable IS_FIRST_RUN=true" | ||
echo "uwazi-docker: Enviroment variable IS_FIRST_RUN is not true. Assume MongoDB and Elastic Search provide already are intialized" | ||
echo "uwazi-docker: [protip] is possible to initialize (or reset o initial state) MongoDB and Elastic Search with enviroment variable IS_FIRST_RUN=true" | ||
fi | ||
|
||
yarn run-production |