Add armhf support

This commit is contained in:
Alex Ellis 2017-02-03 13:31:39 +00:00
commit 726e9c6d36
12 changed files with 173 additions and 6 deletions

4
build.armhf.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
(cd gateway && ./armhf.build.sh)
(cd watchdog && ./armhf.build.sh)

View File

@ -1,4 +1,5 @@
#!/bin/sh
echo "Deploying stack"
docker stack deploy func --compose-file docker-compose.yml
docker stack deploy func --compose-file docker-compose.yml

4
deploy_stack_arm.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "Deploying stack"
docker stack deploy func --compose-file docker-compose.armhf.yml

103
docker-compose.armhf.yml Normal file
View File

@ -0,0 +1,103 @@
version: "3"
services:
# Core API services are pinned, HA is provided for functions.
gateway:
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
ports:
- 8080:8080
image: alexellis2/faas-gateway:latest-armhf
networks:
- functions
deploy:
placement:
constraints: [node.role == manager]
prometheus:
image: alexellis2/prometheus-armhf:latest
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus/alert.rules:/etc/prometheus/alert.rules
command: "-config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -storage.local.memory-chunks=10000 --alertmanager.url=http://alertmanager:9093"
ports:
- 9090:9090
depends_on:
- gateway
- alertmanager
environment:
no_proxy: "gateway"
networks:
- functions
deploy:
placement:
constraints: [node.role == manager]
alertmanager:
image: alexellis2/alertmanager-armhf
environment:
no_proxy: "gateway"
volumes:
- ./prometheus/alertmanager.yml:/alertmanager.yml
command:
- '-config.file=/alertmanager.yml'
networks:
- functions
ports:
- 9093:9093
deploy:
placement:
constraints: [node.role == manager]
# Sample functions go here.
wordcount:
image: alexellis2/faas-alpinefunction:latest-armhf
depends_on:
- gateway
networks:
- functions
environment:
fprocess: "wc"
no_proxy: "gateway"
https_proxy: $https_proxy
echoit:
image: alexellis2/faas-alpinefunction:latest-armhf
depends_on:
- gateway
networks:
- functions
environment:
fprocess: "cat"
no_proxy: "gateway"
https_proxy: $https_proxy
nodeinfo:
image: alexellis2/faas-nodeinfo:latest-armhf
depends_on:
- gateway
networks:
- functions
environment:
no_proxy: "gateway"
https_proxy: $https_proxy
hubstats:
image: alexellis2/faas-hubstats:latest-armhf
depends_on:
- gateway
networks:
- functions
environment:
no_proxy: "gateway"
https_proxy: $https_proxy
networks:
functions:
driver: overlay
# Docker does not support this option yet - maybe create outside of the stack and reference as "external"?
#attachable: true

View File

@ -6,11 +6,15 @@ RUN go get -d github.com/docker/docker/api/types \
&& go get -d github.com/docker/docker/client \
&& go get github.com/gorilla/mux \
&& go get github.com/prometheus/client_golang/prometheus
RUN go get -d github.com/Sirupsen/logrus
WORKDIR /go/src/github.com/alexellis/faas/gateway
COPY metrics metrics
COPY server.go .
COPY metrics metrics
COPY requests requests
COPY tests tests
COPY handlers handlers
COPY server.go .
RUN find /go/src/github.com/alexellis/faas/gateway/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .

View File

@ -0,0 +1,8 @@
FROM armhf/alpine:latest
COPY fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
# Populate example here
# ENV fprocess="wc -l"
CMD ["fwatchdog"]

View File

@ -0,0 +1,3 @@
#!/bin/bash
docker build -f Dockerfile.armhf -t alexellis2/faas-alpinefunction:latest-armhf .

View File

@ -0,0 +1,17 @@
FROM alexellis2/go-armhf:1.7.4
MAINTAINER alexellis2@gmail.com
ENTRYPOINT []
RUN apk --no-cache add make
WORKDIR /go/src/github.com/alexellis/faas/sample-functions/DockerHubStats
COPY . /go/src/github.com/alexellis/faas/sample-functions/DockerHubStats
RUN make
COPY ./fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
ENV fprocess "/go/bin/DockerHubStats"
CMD [ "/usr/bin/fwatchdog"]

View File

@ -0,0 +1,3 @@
#!/bin/bash
docker build -t alexellis2/faas-hubstats:latest-armhf .

View File

@ -0,0 +1,12 @@
FROM armhf/alpine:latest
RUN apk --update add nodejs
COPY fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
COPY package.json .
COPY main.js .
RUN npm i
ENV fprocess="node main.js"
CMD ["fwatchdog"]

View File

@ -0,0 +1,3 @@
#!/bin/bash
docker build -f Dockerfile.armhf -t alexellis2/faas-nodeinfo:latest-armhf .

View File

@ -1,7 +1,12 @@
FROM alexellis2/go-armhf:1.7.4
RUN mkdir -p /go/src/app
COPY main.go /go/src/app
WORKDIR /go/src/app
COPY main.go .
COPY readconfig.go .
COPY config_test.go .
WORKDIR /go/src/app
RUN go get -d -v
RUN go test
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .