Skip to content

Commit

Permalink
Local docker compose (#332)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <[email protected]>
  • Loading branch information
haiodo authored Nov 22, 2021
1 parent 1e16743 commit ef0c3e8
Show file tree
Hide file tree
Showing 30 changed files with 455 additions and 135 deletions.
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug server",
"type": "node",
"request": "launch",
"args": ["src/__start.ts"],
"env": {
"ELASTIC_URL": "http://localhost:9200",
"MONGO_URL": "mongodb://localhost:27017"
},
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"sourceMaps": true,
"cwd": "${workspaceRoot}/server/server",
"protocol": "inspector"
}
]
}
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,40 @@ You need Microsoft's [rush](https://rushjs.io) to install application. Install [
cd dev/prod
rushx dev
```

Then go to http://localhost:8080/login:component:LoginApp and use following credentials to login into the system:

* login: [email protected]
* pass: 1111
* workspace: trx40
- login: [email protected]
- pass: 1111
- workspace: trx40

To connect to running local server `dev-server` command should be used instead.

## Build and run inside docker

It is possible to setup all environment required with local docker containers.
Supported both amd64 and armv8 containers.

```bash
rush build # Will build all required packages.
rush bundle # Will prepare bundles.
rush docker:build # Will build docker containers for all applications.
cd ./dev/
docker-compose up -d --force-recreate # Will setup all containers

# we a few seconds delay, to be sure elastic is up and running.
./deploy/setup-es-attachment-pipeline.sh # Setup elastic search plugin configuration.
```

By default docker volumes `dev_db` `dev_elastic` `dev_files` will be created for mongo/elastic/minio instances.

Before we could start we need to create workspace/account and associate it with workspace.

```bash
cd ./dev/tools
rushx run-local create-workspace ws1 -o DevWorkspace # Create workspace
rushx run-local create-account user1 -p 1234 -f John -l Appleseed # Create account
rushx run-local assign-workspace user1 ws1 # Assign worksapce to user
```

Following URL http://localhost:8081/login:component:LoginApp will lead us to app.
21 changes: 21 additions & 0 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,27 @@
"ignoreDependencyOrder": false,
"ignoreMissingScript": true
},

{
"commandKind": "bulk",
"name": "docker:build",
"summary": "docker:build",
"description": "Build and make docker containers",
"enableParallelism": true,
"incremental": true,
"ignoreDependencyOrder": false,
"ignoreMissingScript": true
},
{
"commandKind": "bulk",
"name": "bundle",
"summary": "bundle",
"description": "Build bundles",
"enableParallelism": true,
"incremental": true,
"ignoreDependencyOrder": false,
"ignoreMissingScript": true
},
],

/**
Expand Down
64 changes: 58 additions & 6 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
services:
mongodb:
image: mongo
container_name: mongodb
environment:
- PUID=1000
- PGID=1000
volumes:
- db:/data/db
ports:
- 27017:27017
restart: unless-stopped
minio:
image: 'minio/minio'
command: server /data --address ":9000" --console-address ":9001"
ports:
- 9000:9000
volumes:
- files:/data
elastic:
image: 'elasticsearch:7.14.0'
command: |
/bin/sh -c "./bin/elasticsearch-plugin list | grep -q ingest-attachment || yes | ./bin/elasticsearch-plugin install --silent ingest-attachment;
/usr/local/bin/docker-entrypoint.sh eswrapper"
volumes:
- elastic:/usr/share/elasticsearch/data
ports:
- 9200:9200
environment:
- ELASTICSEARCH_PORT_NUMBER=9200
- BITNAMI_DEBUG=true
- discovery.type=single-node
account:
image: anticrm/account
links:
- mongodb
ports:
- 3000:3000
environment:
- MONGO_URL=mongodb://mongodb:27017
- TRANSACTOR_URL=ws://localhost:3333
front:
image: anticrm/front
links:
- mongodb
- minio
- elastic
- server
- upload
ports:
- 8081:8080
environment:
- ACCOUNTS_URL=http://localhost:3000
- UPLOAD_URL=/files
- TRANSACTOR_URL=ws://localhost:3333
- ELASTIC_URL=http://elastic:9200
- MINIO_ENDPOINT=minio
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
transactor:
image: anticrm/transactor
links:
- mongodb
- elastic
ports:
- 3333:3333
environment:
- ELASTIC_URL=http://elastic:9200
- MONGO_URL=mongodb://mongodb:27017
volumes:
db:
files:
elastic:
10 changes: 4 additions & 6 deletions dev/prod/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

CLIENT_TYPE=dev
ACCOUNTS_URL=/account
UPLOAD_URL=/upload
LOGIN_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJvc2FtdW5kQGhjLmVuZ2luZWVyaW5nIiwid29ya3NwYWNlIjoidHJ4NDAifQ.dYsCF2VRbuc-zmRt0yLAww1_--xtX4P1EqPFREEzCjQ
# LOGIN_ENDPOINT=ws://localhost:3333
LOGIN_ENDPOINT=wss://transactor.hc.engineering/
LOGIN_ENDPOINT=ws://localhost:3333

LOGIN_TOKEN_DEV=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJvc2FtdW5kQGhjLmVuZ2luZWVyaW5nIiwid29ya3NwYWNlIjoidHJ4NDAifQ.dYsCF2VRbuc-zmRt0yLAww1_--xtX4P1EqPFREEzCjQ
LOGIN_ENDPOINT_DEV=wss://transactor.hc.engineering/
5 changes: 0 additions & 5 deletions dev/prod/.env-prod
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@


#ACCOUNTS_URL=https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/
ACCOUNTS_URL=https://account.hc.engineering/
UPLOAD_URL=/files
1 change: 1 addition & 0 deletions dev/prod/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ACCOUNTS_URL":"http://localhost:3000","UPLOAD_URL":"/files"}
9 changes: 5 additions & 4 deletions dev/prod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "1.0.1",
"license": "EPL-2.0",
"scripts": {
"build": "cross-env NODE_ENV=production webpack --stats-error-details && echo 'done'",
"build": "cross-env NODE_ENV=development webpack --stats-error-details && echo 'done'",
"analyze": "cross-env NODE_ENV=production webpack --json > stats.json",
"show": "webpack-bundle-analyzer stats.json dist",
"dev": "cross-env webpack serve --content-base public",
"dev-server": "cross-env CLIENT=server webpack serve --content-base public",
"dev": "cross-env CLIENT_TYPE=dev webpack serve --content-base public",
"dev-server": "cross-env CLIENT_TYPE=dev-server webpack serve --content-base public",
"start": "cross-env NODE_ENV=production webpack serve --content-base public",
"preformat-svelte": "prettier -w src/**/*.svelte",
"lint": "eslint --max-warnings=0 src",
Expand All @@ -33,7 +33,8 @@
"autoprefixer": "^10.2.6",
"postcss": "^8.3.4",
"postcss-loader": "^6.1.0",
"postcss-load-config": "^3.1.0"
"postcss-load-config": "^3.1.0",
"compression-webpack-plugin": "~9.0.0"
},
"dependencies": {
"@anticrm/platform": "~0.6.5",
Expand Down
4 changes: 4 additions & 0 deletions dev/prod/public/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"ACCOUNTS_URL":"/account",
"UPLOAD_URL":"/files"
}
1 change: 1 addition & 0 deletions dev/prod/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</head>

<body style="margin: 0; overflow: hidden;">
<script src='/vendors.js'></script>
<script src='/bundle.js'></script>
</body>

Expand Down
Loading

0 comments on commit ef0c3e8

Please sign in to comment.