Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deploy Bud to Real-world ? #202

Open
ghost opened this issue Jul 14, 2022 · 5 comments
Open

How to deploy Bud to Real-world ? #202

ghost opened this issue Jul 14, 2022 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@ghost
Copy link

ghost commented Jul 14, 2022

I want to deploy to ec2, or heroku. How can I do that ? (I'm newbie)

@matthewmueller
Copy link
Contributor

Hey @gunnrcrakr, I'm working on documentation for this! Right now it'd be a bit manual:

  1. Launch an EC2 instance
  2. scp your code to that instance or build the binary locally in a linux docker container
  3. SSH into that instance
  4. Build the binary if you haven't already
  5. Start the binary
  6. Optionally setup systemd to restart the binary when the instance restarts or process crashes.

@matthewmueller matthewmueller added the documentation Improvements or additions to documentation label Jul 15, 2022
@ghost
Copy link
Author

ghost commented Jul 21, 2022

Hey @gunnrcrakr, I'm working on documentation for this! Right now it'd be a bit manual:

  1. Launch an EC2 instance
  2. scp your code to that instance or build the binary locally in a linux docker container
  3. SSH into that instance
  4. Build the binary if you haven't already
  5. Start the binary
  6. Optionally setup systemd to restart the binary when the instance restarts or process crashes.

Do I have to install livebud on that ec2 ?

@jfmario
Copy link
Contributor

jfmario commented Jul 21, 2022

This is what I've been working with for running the bud app with docker:

FROM golang:1.18.4-buster

# install node & npm
RUN apt-get update
RUN apt-get install -y curl
RUN curl sL https://deb.nodesource.com/setup_16.x | bash
RUN apt-get install -y nodejs

# install bud
RUN curl -sf https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh

# build your app
COPY . /app
WORKDIR /app

# will not work if you have the broken relative path in go.mod
RUN bud build

EXPOSE 3000
EXPOSE 35729

ENTRYPOINT ./bud/app --listen 0.0.0.0:3000 --log debug

# docker run -it -p 3000:3000 -p 35729:35729 <image-name>

@inluxc
Copy link

inluxc commented Jul 22, 2022

The best way is to build in a builder container and then copy to a scratch container just the build.

Then push to an docker registry so we can download the latest version.
I will do an github action and gitlab ci and do an example repo.

@Fuerback
Copy link

Here is how I'm doing it @inluxc

FROM node:18-buster AS builder

COPY --from=golang:1.19-buster /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"

RUN curl -sf curl https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh -s 0.2.8

WORKDIR /app

COPY . /app
RUN npm install
RUN go mod download
RUN bud build

FROM debian:buster-slim

RUN apt-get update && apt-get install -y ca-certificates openssl
ARG cert_location=/usr/local/share/ca-certificates
RUN update-ca-certificates

COPY --from=builder /app/bud/app /
COPY --from=builder /app/go.mod /

EXPOSE 3000

ENTRYPOINT ./app --listen 0.0.0.0:3000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants