Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The deployment for Go

linyows
October 04, 2018

The deployment for Go

Fukuoka.go#12 October 4, 2018 でお話しした 資料です

linyows

October 04, 2018
Tweet

More Decks by linyows

Other Decks in Technology

Transcript

  1. 'VLVPLBHP ๏ ϫϯόΠφϦͷσϓϩΠ໰୊Λղܾ͢Δ w IUUQTTQFBLFSEFDLDPNMJOZPXTTDBMBCMFEFQMPZNFOUUPPMUPEFQMPZPOZPVSPXO w !'VLVPLBHP w $BQJTUSBOPΛ(PΞϓϦͰ࢖͏ͷ͸ΦʔόʔΩϧײ͕͋ͬͯͲ͏ʹ͔͢Δͱ͍͏಺༰ ๏

    εέʔϥϒϧͰσϓϩΠΛҙࣝ͠ͳ͍௒ཱࣗܕσϓϩΠ w IUUQTTQFBLFSEFDLDPNMJOZPXTSFTPMWFXFCBQQMJDBUJPOEFQMPZNFOUQSPCMFNTGPSHP w !1)1$POGFSFODF'VLVPLBલ໷ࡇ3FKFDUDPO w ͜Ε·ͰͷσϓϩΠख๏Λ౿·͑ͭͭ৽͍͠σϓϩΠख๏ͷఏҊ ࠓ೥ʹೖͬͯ৽͍͠σϓϩΠख๏ʹ͍ͭͯ౓ఔൃද
  2. 'VLVPLBHP 1 #!/bin/bash 2 set -xe 3 4 readonly REMOTE_USER="linyows"

    5 6 function deploy () { 7 local sshc="ssh $1 -l $REMOTE_USER" 8 scp ./api.zip $REMOTE_USER@$1:/home/$REMOTE_USER 9 10 $sshc "unzip /home/$REMOTE_USER/api.zip" 11 $sshc 'sudo mv api /usr/local/bin' 12 $sshc 'sudo chown api /usr/local/bin/api' 13 $sshc 'sudo service api restart' 14 } 15 16 deploy 'api-1.example.test' 17 deploy 'api-2.example.test' 18 deploy 'api-3.example.test' ݱ৔ͷ༷ࢠͰ͢
  3. 'VLVPLBHP %FQMPZJOH%FNP server: 1 $ export GITHUB_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 $ dewy

    server \ 3 --repository linyows/dewy-testapp \ 4 --artifact dewy-testapp_darwin_amd64.tar.gz \ 5 --port 8000 \ 6 --log-level info -- \ 7 /var/www/my-app/current/my-app client: 1 $ while sleep 0.5; do curl localhost:8000; done dev: 1 $ export GITHUB_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 $ goreleaser --rm-dist
  4. 'VLVPLBHP ๏ )PPLܥͷ௥ՃλεΫ SFRVJSFE ๏ 1MVHJOػߏ ๏ ϩʔϧόοΫ SFRVJSFE ๏

    ΧφϦʔσϓϩΠ ๏ ෼ࢄ,74ͷରԠʢ&UDENC $POTVM,7LC ࠓޙͷ՝୊