63 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| # All required components, to create and fill a database,
 | |
| # instantiate backend and frontend. 
 | |
| 
 | |
| MAKE_ROOT = $(shell pwd)
 | |
| 
 | |
| ### Input data
 | |
| # I received ssj500k in one .xml file,
 | |
| # kres is composed of many .xml files
 | |
| # I generated srl tags for kres in separate .json files
 | |
| # (for each kres.xml file there is a kres.json file with srl tags)
 | |
| SSJ_FILE = "$(MAKE_ROOT)/data/samples/ssj_example/ssj500k-sl.body.sample.xml"
 | |
| KRES_FOLDER = "$(MAKE_ROOT)/data/samples/kres_example"
 | |
| KRES_SRL_FOLDER = "$(MAKE_ROOT)/data/kres_srl"
 | |
| OUTPUT = "db"
 | |
| OUTDIR = "/home/voje/workdir/test_out"
 | |
| DBADDR = "0.0.0.0:27017"  # don't use localhost
 | |
| 
 | |
| DB_ADM_USER = testadmin
 | |
| DB_ADM_PASS = testadminpass
 | |
| DB_USR_USER = testuser
 | |
| DB_USR_PASS = testuserpass
 | |
| export
 | |
| 
 | |
| .PHONY: python-env fill_database
 | |
| 
 | |
| all:
 | |
| 	echo "Select an argument"
 | |
| 
 | |
| # create database (run from host):
 | |
| # !!! might need to run several times, so the containers come online
 | |
| # Successful if you see the lines:
 | |
| # Successfully added user: { "user" : "testuser", "roles" : [ "readWrite" ] }
 | |
| # bye
 | |
| database-service:
 | |
| 	cd dockerfiles/database; $(MAKE) build_run
 | |
| 
 | |
| database-users:
 | |
| 	cd dockerfiles/database; $(MAKE) create_users
 | |
| 
 | |
| # also useful, if we want to restart the db
 | |
| database-clean:
 | |
| 	cd dockerfiles/database; $(MAKE) clean_stack
 | |
| 
 | |
| # create python-env container
 | |
| python-env:
 | |
| 	cd dockerfiles/python-env; $(MAKE)
 | |
| 
 | |
| # inside the container, install our packages
 | |
| python-env-install:
 | |
| 	pip3 install -e src/pkg/cjvt-corpusparser/.
 | |
| 
 | |
| # from inside python-env container:
 | |
| data/samples:
 | |
| 	cd data; tar xzvf samples.tar.gz
 | |
| 
 | |
| # from inside python-env container:
 | |
| fill_database: data/samples
 | |
| 	python3 src/pkg/cjvt-corpusparser/corpusparser/main.py --kres-folder $(KRES_FOLDER) \
 | |
| 		--ssj-file $(SSJ_FILE) --kres-srl-folder $(KRES_SRL_FOLDER) \
 | |
| 		--output $(OUTPUT) --outdir $(OUTDIR) --dbaddr $(DBADDR) \
 | |
| 		--dbuser $(DB_USR_USER) --dbpass $(DB_USR_PASS)
 | |
| 
 |