GithubHelp home page GithubHelp logo

zero2prod's Introduction

Zero To Production / Code (Chapter 5)

Zero To Production In Rust is an opinionated introduction to backend development using Rust.

This repository serves as supplementary material for the book: it hosts snapshots of the codebase of our email newsletter project at end of each chapter.

This branch is a snapshot of the project at the end of Chapter 5.

Pre-requisite

You'll need to install:

Launch a (migrated) Postgres database via Docker:

./scripts/init_db.sh

How to build

cargo build

How to test

cargo test

How to run

cargo run

In separate terminal

curl -v http://127.0.0.1:8000/health_check
or
curl -v POST --data 'name=le%20guin&email=ursula_le_guin%40gmail.com' 127.0.0.1:8000/subscriptions

Build Docker container

docker build --tag zero2prod --file Dockerfile .

Run in Docker container

docker run -p 8000:8000 zero2prod

Show Docker image build size

docker images zero2prod

Create app at DigitalOcean

Connect doctl to DigitalOcean

doctl auth init

Link GitHub account to DigitalOcean

doctl apps create --spec spec.yaml

List apps on DigitalOcean

doctl apps list

Alternatively: DigitalOcean Dashboard

Update DO app

doctl apps update YOUR-APP-ID --spec=spec.yaml

DigitalOcean API

Working with doctl

doctl --help
doctl apps --help
doctl apps update --help

DigitalOcean API V2 docs

Get instance_sizes

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer e7a53616474e591c80758a2d014928d40af916d182aff51683419fc8bb351fa5" "https://api.digitalocean.com/v2/apps/tiers/instance_sizes"

zero2prod's People

Contributors

gihrig avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.