25cab583c19e2d0fea4266e7ef453e8f6c03d9e0
Several approaches of normalizing json were tried and ultimately found impractical at this point. Using a hybrid of tables and json is the current approach; this may be further normalized later.
Overview
TODO diagram
TODO Style notes
- NO package init() functions
- Dynamic behaviour must be explicit
Cross-compile server on host, run it in container
These are simple steps using a single container.
-
build server on host
GOOS=linux GOARCH=arm64 go build -
build docker image
docker build -t server-image . -
Start container with shared directory
docker run -it \ -v /Users/hohn/work-gh/mrva/mrvacommander:/mrva/mrvacommander \ server-image -
Run server in container
cd /mrva/mrvacommander/cmd/server/ && ./server
Using docker-compose
Steps to build and run the server in a multi-container environment set up by docker-compose.
-
Build server on host
cd ~/work-gh/mrva/mrvacommander/cmd/server/ GOOS=linux GOARCH=arm64 go build -
Start the containers
cd ~/work-gh/mrva/mrvacommander/ docker-compose down docker-compose up -d -
Run server in its container
cd ~/work-gh/mrva/mrvacommander/ docker exec -it server bash cd /mrva/mrvacommander/cmd/server/ ./server -loglevel=debug -mode=container -
Test server via remote client by following the steps in gh-mrva
Some general docker-compose commands
-
Get service status
docker-compose ps -
Stop services
docker-compose down -
View all logs
docker-compose logs -
check containers from server container
docker exec -it server bash curl -I postgres:5432 curl -I http://rabbitmq:15672
Some postgres specific commands
-
Access PostgreSQL
psql -h localhost -p 5432 -U exampleuser -d exampledb -
List all tables
\dt
To run pgmin, the minimal go/postgres test part of this repository:
-
Run pgmin
cd ~/work-gh/mrva/mrvacommander/cmd/postgres GOOS=linux GOARCH=arm64 go build docker exec -it server bash /mrva/mrvacommander/cmd/postgres/postgresExit the container. Back on the host:
psql -h localhost -p 5432 -U exampleuser -d exampledb \dtShould show
List of relations Schema | Name | Type | Owner --------+-------------+-------+------------- public | owner_repos | table | exampleuser -
Check table contents
exampledb=# select * from owner_repos; owner | repo -------+--------- foo | foo/bar
Description
Languages
Go
47.7%
Jupyter Notebook
21.2%
Python
17.4%
CSS
6.3%
Dockerfile
3.6%
Other
3.7%