Skip to content

Commit

Permalink
Merge pull request #120 from bblfsh/examples
Browse files Browse the repository at this point in the history
Dockerfile and README: quick start
  • Loading branch information
abeaumont authored Oct 9, 2017
2 parents 5a3365e + 72ca6b3 commit a9dd6df
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ RUN apt-get update && \
libostree-1-1 \
&& apt-get clean

ADD build /bin/
ENTRYPOINT ["/bin/bblfshd"]
ADD build/bin /opt/bblfsh/bin/
ADD etc /opt/bblfsh/etc/
ENV PATH="/opt/bblfsh/bin:${PATH}"

ENTRYPOINT ["bblfshd"]

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ build-internal:
mkdir -p $(BUILD_PATH); \
for cmd in $(COMMANDS); do \
cd $(CMD_PATH)/$${cmd}; \
$(GO_BUILD) --ldflags '$(LDFLAGS)' -o $(BUILD_PATH)/$${cmd} .; \
$(GO_BUILD) --ldflags '$(LDFLAGS)' -o $(BUILD_PATH)/bin/$${cmd} .; \
done;

build-fixture:
Expand Down
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# bblfshd [![Build Status](https://travis-ci.org/bblfsh/bblfshd.svg?branch=master)](https://travis-ci.org/bblfsh/bblfshd) [![codecov](https://codecov.io/gh/bblfsh/bblfshd/branch/master/graph/badge.svg)](https://codecov.io/gh/bblfsh/bblfshd) [![license](https://img.shields.io/badge/license-GPL--3.0-blue.svg)](https://github.com/bblfsh/bblfshd/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/bblfsh/bblfshd.svg)](Release)
# bblfshd [![Build Status](https://travis-ci.org/bblfsh/bblfshd.svg?branch=master)](https://travis-ci.org/bblfsh/bblfshd) [![codecov](https://codecov.io/gh/bblfsh/bblfshd/branch/master/graph/badge.svg)](https://codecov.io/gh/bblfsh/bblfshd) [![license](https://img.shields.io/badge/license-GPL--3.0-blue.svg)](https://github.com/bblfsh/bblfshd/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/bblfsh/bblfshd.svg)](https://github.com/bblfsh/bblfshd/releases)

This repository contains bblfsh daemon (*bblfshd*), which includes the
runtime that runs the driver in *containers* and the bblfshctl, a cli tool used
Expand All @@ -12,6 +12,49 @@ on GitHub. For more information, see [bblfsh SDK documentation](https://doc.bblf

See the [Getting Started](https://doc.bblf.sh/user/getting-started.html) guide.

### Quick start

The recommended way to run *bblfshd* is using *docker*:

```sh
docker run -d --name bblfshd --privileged -p 9432:9432 -v /var/lib/bblfshd:/var/lib/bblfshd bblfsh/bblfshd
```

The container should be executed with the `--privileged` flag since *bblfshd* it's
based on [container technology](https://github.com/opencontainers/runc/tree/master/libcontainer)
and interacts with the kernel at a low level. *bblfshd*, expose a gRPC server at
the port `9432` by default, this gRPC will be used by the [clients](https://github.com/search?q=topic%3Aclient+org%3Abblfsh&type=Repositories)
to interact with the server. Also, we mount the path `/var/lib/bblfshd/` where
all the driver images and container instances will be stored.

Now you we need to install the driver images into the daemon, you can install
the official images just running the command:

```sh
docker exec -it bblfshd bblfshctl driver install --all
```

You can check the installed versions executing:
```
docker exec -it bblfshd bblfshctl driver list
```

```
+----------+-------------------------------+---------+--------+---------+--------+-----+-------------+
| LANGUAGE | IMAGE | VERSION | STATUS | CREATED | OS | GO | NATIVE |
+----------+-------------------------------+---------+--------+---------+--------+-----+-------------+
| python | //bblfsh/python-driver:latest | v1.1.5 | beta | 4 days | alpine | 1.8 | 3.6.2 |
| java | //bblfsh/java-driver:latest | v1.1.0 | alpha | 6 days | alpine | 1.8 | 8.131.11-r2 |
+----------+-------------------------------+---------+--------+---------+--------+-----+-------------+
```

To test the driver you can executed a parse request to the server with the `bblfshctl parse` command,
and an example contained in the docker image:

```sh
docker exec -it bblfshd bblfshctl parse /opt/bblfsh/etc/examples/python.py
```

## Development

If you wish to work on *bblfshd* , you'll first need [Go](http://www.golang.org)
Expand Down
5 changes: 5 additions & 0 deletions etc/examples/java.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
1 change: 1 addition & 0 deletions etc/examples/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, World!")

0 comments on commit a9dd6df

Please sign in to comment.