{"_id":"57d8460fb5d28c2900fb55bb","project":"552829408962f339009a678d","__v":0,"category":{"_id":"57d556a2496a3117004d70cf","__v":0,"project":"552829408962f339009a678d","version":"552829408962f339009a6790","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-09-11T13:05:38.479Z","from_sync":false,"order":1,"slug":"docker","title":"Quick Start (Docker)"},"user":"55282916d9e1db2d00cd923c","parentDoc":null,"version":{"_id":"552829408962f339009a6790","project":"552829408962f339009a678d","__v":26,"createdAt":"2015-04-10T19:49:20.516Z","releaseDate":"2015-04-10T19:49:20.516Z","categories":["552829418962f339009a6791","55284ed68962f339009a67e1","55286c73391a362500d9b3f4","552918f6b316811900149f59","5529b255d739240d00a3483e","553287590a578a0d008d4ff5","55329385e7d1fa0d003fc946","5550b55200420e0d00d1312f","55525fca953c9c0d00f507d7","559199695631432f002d358a","559d8d96980b801700d5ec7e","55c5e833cccdeb2d004e24b9","55d76504f662951900fc0e7d","55ea213cc62aa02f008229cd","56157b750f5ed00d00483dd8","561981fbac0924170069f4e8","561b8b1ea430930d0037ea67","563417428b86331700b488ca","56cd785bface161300dae0ec","56cdcc6e70db8a15006395f4","56cdf1b749abf10b0036a34a","56cedc8ce50c9c1b00830423","56e97ba8d825061900d1ac83","570d505228e6900e00477229","573614ca2ab52e1700c8e851","57d556a2496a3117004d70cf"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-13T18:31:43.753Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"Actor Platform configuration can take time and we suggest you to install bare minimum to start and then configure everything else.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"TL;DR;\",\n  \"body\": \"If you are lazy just scroll to bottom of the page to get required commands.1\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Initial Configuration\"\n}\n[/block]\nIn easiest configuration is just 3 components: Web App, Actor Server and PostgreSQL database. As you can see on the picture Web Server doesn't interact with Actor Server at all and you can host in anywhere, but Actor Server and PostgreSQL need to be accessible and be in one local network. For simplicity we will assume that everything is running on one machine with Docker installed.\n\nOn our initial setup client to server communications doesn't use TLS encryption, but it is not necessary as we already have built-int encryption that is safe to use over non-TLS-encrypted connections. But when you start to host your WebApp on encrypted page (https://...) then most modern browsers will start to require you to use TLS connections for WebSockets and you will need to install additional proxy. In our initial setup we are not going to add encryption proxy for keeping things simple.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/08536da-Simple_1.png\",\n        \"Simple (1).png\",\n        621,\n        188,\n        \"#6c84b4\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 0: Install Docker and pick data location\"\n}\n[/block]\nOur guide is intended to use [Docker](https://docker.com) so, please, install it on your server (or local machine).\n\nWe assume that all Actor-related data will be stored at `/data` directory, please adjust path to your operating system.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 1: Get Activation token\"\n}\n[/block]\nBefore starting to use Actor server you need to [get Activation Token](doc:sms-gate-token) for accessing our SMS GateWay. This token is used to send verification SMS for authentication (primary method of authentication in Actor). SMS GateWay is Free for the first 1000 SMS. After reaching limits we will charge you average market price for SMS. You might think that it will be cheaper for you to make your own gateway, but we don't have intentions to make money on this SMS and not adding any costs above it. Otherwise we are trying to reduce it's price as our network grow. Also this \"centralization point\" will be required in nearest future for federation purposes. For more informations you can ask at speed:::at:::actor.im.\n\n## Results:\n* You have activation token and it is looks like '13b028e78b127310588e1a7bda324c0fd9b577'\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 2: Prepare Secure Credentials\"\n}\n[/block]\nBefore starting to configure you server you need to prepare encryption keys and shared secret for your Actor Server. We are prepared simple script to generate it with one line. This script will print you shared secret and generated 4 encryption keys.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker run -v /data/:/keygen actor/keygen\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nSave output of a command - this is your ACTOR_SECRET (shared secret).\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"If process freezes then you possible doesn't have enough entropy on your machine\",\n  \"body\": \"In virtualized environments there are too small entropy to generate keys and you can run ```docker run --privileged -d harbur/haveged:1.7c-1``` to gain more\"\n}\n[/block]\n## Results\n* At least 4 pairs of actor-key.pub + actor-key.key in `/data/keys/` directory\n* Cryptographically strong Shared Secret\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 3: Install PostgreSQL\"\n}\n[/block]\nInstalling PostgreSQL with docker is a very simple process:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker run \\\\\\n\\t--name actor-postgres \\\\\\n\\t-e POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD> \\\\\\n\\t-e POSTGRES_USER=actor \\\\\\n\\t-e POSTGRES_DB=actor \\\\\\n\\t-p 5432:5432 \\\\\\n  -v /data/database:/var/lib/postgresql/data \\\\\\n\\t-d \\\\\\n\\tpostgres:9.6\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nRemember \"<YOUR_POSTGRES_PASSWORD>\" as we will use it in our next steps.\n\n## How to check\nTo check if everything is running try to connecto to psql via another docker container:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker run -it --rm --link actor-postgres:postgres postgres:9.6 psql -h postgres -U actor\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIf it connects then everything is ok and you can just send `\\q` to exit.\n\nAs additional check you can try to remove container (`docker rm actor-postgres`), start process again and validate that everything is working.\n\n## Restults\n* Working PostgreSQL database\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 5: Install Actor Server\"\n}\n[/block]\nInstalling Actor is very easy too, just one command in docker:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker run \\\\\\n\\t--name actor \\\\\\n\\t--link actor-postgres:postgres \\\\\\n  -e ACTOR_SECRET=<YOUR_SHARED_SECRET> \\\\\\n  -e ACTOR_DB_PASSWORD=<YOUR_POSTGRES_PASSWORD> \\\\\\n  -e ACTOR_GATE_TOKEN=<YOUR_ACTIVATION_GATE_TOKEN> \\\\\\n  -v /data/files:/files \\\\\\n  -v /data/keys:/keys:ro \\\\\\n  -d \\\\\\n  -p 9070:9070 \\\\\\n  -p 9080:9080 \\\\\\n  -p 9090:9090 \\\\\\n  actor/server\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n## How To Validate\n* Try to open [http://localhost:9090/v1/status](http://localhost:9090/v1/status) and you should see:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"status\\\" : \\\"Ok\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n## Results\n* Working Actor Server!\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 6: Install Web App\"\n}\n[/block]\nInstalling Web App can be easily via command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker run \\\\\\n\\t-p 3000:3000 \\\\\\n\\t-e ACTOR_ENDPOINT=ws://localhost:9080 \\\\\\n  -d \\\\\\n  actor/web\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nNow you can open [http://localhost:3000](http://localhost:3000) and login to your server!\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/cce079a-Screen_Shot_2016-09-14_at_3.39.34_AM.png\",\n        \"Screen Shot 2016-09-14 at 3.39.34 AM.png\",\n        2880,\n        1800,\n        \"#e8eae9\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"TL;DR;\"\n}\n[/block]\nJust run this commands line by line and open [http://localhost:3000](http://localhost:3000).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export DATA_DIR=/data/\\nexport DB_PASSWORD=<YOUR_DATABASE_PASSWORD>\\nexport GATE_TOKEN=<YOUR_SMS_TOKEN>\\ndocker run -v $DATA_DIR:/keygen actor/keygen\\nexport SHARED_SECRET=<OUTPUT_FROM_PREVIOUS_COMMAND>\\ndocker run \\\\\\n  --name actor-postgres \\\\\\n  -e POSTGRES_PASSWORD=$DB_PASSWORD \\\\\\n  -e POSTGRES_USER=actor \\\\\\n  -e POSTGRES_DB=actor \\\\\\n  -p 5432:5432 \\\\\\n  -v /data/database:/var/lib/postgresql/data \\\\\\n  -d \\\\\\n  postgres:9.6\\ndocker run \\\\\\n  --name actor \\\\\\n  --link actor-postgres:postgres \\\\  \\n  -e ACTOR_SECRET=$SHARED_SECRET \\\\\\n  -e ACTOR_DB_PASSWORD=$DB_PASSWORD \\\\\\n  -e ACTOR_GATE_TOKEN=$GATE_TOKEN \\\\\\n  -v $DATA_DIR/files:/files \\\\\\n  -v $DATA_DIR/keys:/keys:ro \\\\\\n  -d \\\\\\n  -p 9070:9070 \\\\\\n  -p 9080:9080 \\\\\\n  -p 9090:9090 \\\\\\n  actor/server\\ndocker run \\\\\\n  --name actor-web \\\\\\n  -p 3000:3000 \\\\\\n  -e ACTOR_ENDPOINT=ws://localhost:9080 \\\\\\n  -d \\\\\\n  actor/web\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Next Steps: Real World Deployment\"\n}\n[/block]\nNow you have working and secure messaging right on your computer! But, to be honest, it is useless without our awesome mobile apps and when server is accessible only from your computer. In next steps we will discuss how to expose Actor Server to real world.","excerpt":"Stages of deployment Actor Platform","slug":"deployment","type":"basic","title":"Deployment"}

Deployment

Stages of deployment Actor Platform

Actor Platform configuration can take time and we suggest you to install bare minimum to start and then configure everything else. [block:callout] { "type": "info", "title": "TL;DR;", "body": "If you are lazy just scroll to bottom of the page to get required commands.1" } [/block] [block:api-header] { "type": "basic", "title": "Initial Configuration" } [/block] In easiest configuration is just 3 components: Web App, Actor Server and PostgreSQL database. As you can see on the picture Web Server doesn't interact with Actor Server at all and you can host in anywhere, but Actor Server and PostgreSQL need to be accessible and be in one local network. For simplicity we will assume that everything is running on one machine with Docker installed. On our initial setup client to server communications doesn't use TLS encryption, but it is not necessary as we already have built-int encryption that is safe to use over non-TLS-encrypted connections. But when you start to host your WebApp on encrypted page (https://...) then most modern browsers will start to require you to use TLS connections for WebSockets and you will need to install additional proxy. In our initial setup we are not going to add encryption proxy for keeping things simple. [block:image] { "images": [ { "image": [ "https://files.readme.io/08536da-Simple_1.png", "Simple (1).png", 621, 188, "#6c84b4" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Step 0: Install Docker and pick data location" } [/block] Our guide is intended to use [Docker](https://docker.com) so, please, install it on your server (or local machine). We assume that all Actor-related data will be stored at `/data` directory, please adjust path to your operating system. [block:api-header] { "type": "basic", "title": "Step 1: Get Activation token" } [/block] Before starting to use Actor server you need to [get Activation Token](doc:sms-gate-token) for accessing our SMS GateWay. This token is used to send verification SMS for authentication (primary method of authentication in Actor). SMS GateWay is Free for the first 1000 SMS. After reaching limits we will charge you average market price for SMS. You might think that it will be cheaper for you to make your own gateway, but we don't have intentions to make money on this SMS and not adding any costs above it. Otherwise we are trying to reduce it's price as our network grow. Also this "centralization point" will be required in nearest future for federation purposes. For more informations you can ask at speed@actor.im. ## Results: * You have activation token and it is looks like '13b028e78b127310588e1a7bda324c0fd9b577' [block:api-header] { "type": "basic", "title": "Step 2: Prepare Secure Credentials" } [/block] Before starting to configure you server you need to prepare encryption keys and shared secret for your Actor Server. We are prepared simple script to generate it with one line. This script will print you shared secret and generated 4 encryption keys. [block:code] { "codes": [ { "code": "docker run -v /data/:/keygen actor/keygen", "language": "text" } ] } [/block] Save output of a command - this is your ACTOR_SECRET (shared secret). [block:callout] { "type": "danger", "title": "If process freezes then you possible doesn't have enough entropy on your machine", "body": "In virtualized environments there are too small entropy to generate keys and you can run ```docker run --privileged -d harbur/haveged:1.7c-1``` to gain more" } [/block] ## Results * At least 4 pairs of actor-key.pub + actor-key.key in `/data/keys/` directory * Cryptographically strong Shared Secret [block:api-header] { "type": "basic", "title": "Step 3: Install PostgreSQL" } [/block] Installing PostgreSQL with docker is a very simple process: [block:code] { "codes": [ { "code": "docker run \\\n\t--name actor-postgres \\\n\t-e POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD> \\\n\t-e POSTGRES_USER=actor \\\n\t-e POSTGRES_DB=actor \\\n\t-p 5432:5432 \\\n -v /data/database:/var/lib/postgresql/data \\\n\t-d \\\n\tpostgres:9.6", "language": "shell" } ] } [/block] Remember "<YOUR_POSTGRES_PASSWORD>" as we will use it in our next steps. ## How to check To check if everything is running try to connecto to psql via another docker container: [block:code] { "codes": [ { "code": "docker run -it --rm --link actor-postgres:postgres postgres:9.6 psql -h postgres -U actor", "language": "shell" } ] } [/block] If it connects then everything is ok and you can just send `\q` to exit. As additional check you can try to remove container (`docker rm actor-postgres`), start process again and validate that everything is working. ## Restults * Working PostgreSQL database [block:api-header] { "type": "basic", "title": "Step 5: Install Actor Server" } [/block] Installing Actor is very easy too, just one command in docker: [block:code] { "codes": [ { "code": "docker run \\\n\t--name actor \\\n\t--link actor-postgres:postgres \\\n -e ACTOR_SECRET=<YOUR_SHARED_SECRET> \\\n -e ACTOR_DB_PASSWORD=<YOUR_POSTGRES_PASSWORD> \\\n -e ACTOR_GATE_TOKEN=<YOUR_ACTIVATION_GATE_TOKEN> \\\n -v /data/files:/files \\\n -v /data/keys:/keys:ro \\\n -d \\\n -p 9070:9070 \\\n -p 9080:9080 \\\n -p 9090:9090 \\\n actor/server", "language": "shell" } ] } [/block] ## How To Validate * Try to open [http://localhost:9090/v1/status](http://localhost:9090/v1/status) and you should see: [block:code] { "codes": [ { "code": "{\n \"status\" : \"Ok\"\n}", "language": "json" } ] } [/block] ## Results * Working Actor Server! [block:api-header] { "type": "basic", "title": "Step 6: Install Web App" } [/block] Installing Web App can be easily via command: [block:code] { "codes": [ { "code": "docker run \\\n\t-p 3000:3000 \\\n\t-e ACTOR_ENDPOINT=ws://localhost:9080 \\\n -d \\\n actor/web", "language": "text" } ] } [/block] Now you can open [http://localhost:3000](http://localhost:3000) and login to your server! [block:image] { "images": [ { "image": [ "https://files.readme.io/cce079a-Screen_Shot_2016-09-14_at_3.39.34_AM.png", "Screen Shot 2016-09-14 at 3.39.34 AM.png", 2880, 1800, "#e8eae9" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "TL;DR;" } [/block] Just run this commands line by line and open [http://localhost:3000](http://localhost:3000). [block:code] { "codes": [ { "code": "export DATA_DIR=/data/\nexport DB_PASSWORD=<YOUR_DATABASE_PASSWORD>\nexport GATE_TOKEN=<YOUR_SMS_TOKEN>\ndocker run -v $DATA_DIR:/keygen actor/keygen\nexport SHARED_SECRET=<OUTPUT_FROM_PREVIOUS_COMMAND>\ndocker run \\\n --name actor-postgres \\\n -e POSTGRES_PASSWORD=$DB_PASSWORD \\\n -e POSTGRES_USER=actor \\\n -e POSTGRES_DB=actor \\\n -p 5432:5432 \\\n -v /data/database:/var/lib/postgresql/data \\\n -d \\\n postgres:9.6\ndocker run \\\n --name actor \\\n --link actor-postgres:postgres \\ \n -e ACTOR_SECRET=$SHARED_SECRET \\\n -e ACTOR_DB_PASSWORD=$DB_PASSWORD \\\n -e ACTOR_GATE_TOKEN=$GATE_TOKEN \\\n -v $DATA_DIR/files:/files \\\n -v $DATA_DIR/keys:/keys:ro \\\n -d \\\n -p 9070:9070 \\\n -p 9080:9080 \\\n -p 9090:9090 \\\n actor/server\ndocker run \\\n --name actor-web \\\n -p 3000:3000 \\\n -e ACTOR_ENDPOINT=ws://localhost:9080 \\\n -d \\\n actor/web", "language": "shell" } ] } [/block] [block:api-header] { "type": "basic", "title": "Next Steps: Real World Deployment" } [/block] Now you have working and secure messaging right on your computer! But, to be honest, it is useless without our awesome mobile apps and when server is accessible only from your computer. In next steps we will discuss how to expose Actor Server to real world.