@@ -1,16 +0,0 @@
|
|||||||
# fx on Amazon Lightsai
|
|
||||||
|
|
||||||
* make sure your instance have docker installed and running,
|
|
||||||
* make sure your instance can be ssh login (with user and password)
|
|
||||||
|
|
||||||
```
|
|
||||||
ssh <user>@<host>
|
|
||||||
```
|
|
||||||
|
|
||||||
* make sure your instance accept port 8866
|
|
||||||
|
|
||||||
* then you can deploy function to remote host
|
|
||||||
|
|
||||||
```
|
|
||||||
DOCKER_REMOTE_HOST_ADDR=<your host> DOCKER_REMOTE_HOST_USER=<your user> DOCKER_REMOTE_HOST_PASSWORD=<your password> ./build/fx up -p 1234 test/functions/func.js
|
|
||||||
```
|
|
||||||
52
docs/ubuntu.md
Normal file
52
docs/ubuntu.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# fx on Ubuntu
|
||||||
|
|
||||||
|
> The guide is verified on Amazon Lightsail ubuntu 18.08 instance
|
||||||
|
|
||||||
|
## Install Docker
|
||||||
|
|
||||||
|
```shell
|
||||||
|
apt-get remove -y docker docker-engine docker.io containerd runc
|
||||||
|
apt-get update -y
|
||||||
|
apt-get install -y apt-transport-https ca-certificates curl software-properties-common lsb-core
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||||
|
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||||
|
apt-get update -y
|
||||||
|
apt-get install -y docker-ce
|
||||||
|
docker run hello-world
|
||||||
|
```
|
||||||
|
|
||||||
|
## Install fx
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ curl -o- https://raw.githubusercontent.com/metrue/fx/master/scripts/install.sh | sudo bash
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deploy a function onto localhost
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ cat func.js
|
||||||
|
|
||||||
|
module.exports = (ctx) => {
|
||||||
|
ctx.body = 'hello world'
|
||||||
|
}
|
||||||
|
|
||||||
|
$ fx up -n test -p 2000 func.js
|
||||||
|
$ curl 127.0.0.1:2000
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deploy a function onto remote host
|
||||||
|
|
||||||
|
* make sure your instance can be ssh login
|
||||||
|
* make sure your instance accept port 8866
|
||||||
|
|
||||||
|
|
||||||
|
If you're first time to deploy a function to remote host, you need init it first
|
||||||
|
```shell
|
||||||
|
DOCKER_REMOTE_HOST_ADDR=<your host> DOCKER_REMOTE_HOST_USER=<your user> DOCKER_REMOTE_HOST_PASSWORD=<your password> fx init
|
||||||
|
```
|
||||||
|
|
||||||
|
then you can deploy function to remote host
|
||||||
|
|
||||||
|
```shell
|
||||||
|
DOCKER_REMOTE_HOST_ADDR=<your host> DOCKER_REMOTE_HOST_USER=<your user> DOCKER_REMOTE_HOST_PASSWORD=<your password> fx up -p 2000 test/functions/func.js
|
||||||
|
```
|
||||||
@@ -3,15 +3,11 @@ set -e
|
|||||||
# ++
|
# ++
|
||||||
# verified on Ubuntu 16.04 x64
|
# verified on Ubuntu 16.04 x64
|
||||||
# ++
|
# ++
|
||||||
user_host=$1
|
apt-get remove -y docker docker-engine docker.io containerd runc
|
||||||
|
apt-get update -y
|
||||||
ssh ${user_host} 'bash -s' <<EOF
|
apt-get install -y apt-transport-https ca-certificates curl software-properties-common lsb-core
|
||||||
apt-get remove -y docker docker-engine docker.io containerd runc
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||||
apt-get update -y
|
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||||
apt-get install -y apt-transport-https ca-certificates curl software-properties-common lsb-core
|
apt-get update -y
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
apt-get install -y docker-ce
|
||||||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \$(lsb_release -cs) stable"
|
docker run hello-world
|
||||||
apt-get update -y
|
|
||||||
apt-get install -y docker-ce
|
|
||||||
docker run hello-world
|
|
||||||
EOF
|
|
||||||
|
|||||||
Reference in New Issue
Block a user