Open ghost opened 2 years ago
Hey @gunnrcrakr, I'm working on documentation for this! Right now it'd be a bit manual:
Hey @gunnrcrakr, I'm working on documentation for this! Right now it'd be a bit manual:
- Launch an EC2 instance
- scp your code to that instance or build the binary locally in a linux docker container
- SSH into that instance
- Build the binary if you haven't already
- Start the binary
- Optionally setup systemd to restart the binary when the instance restarts or process crashes.
Do I have to install livebud on that ec2 ?
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>
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.
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
I want to deploy to ec2, or heroku. How can I do that ? (I'm newbie)