Skip to content

Commit

Permalink
Prepare to migrate to new server
Browse files Browse the repository at this point in the history
  • Loading branch information
Irae Hueck Costa committed Jan 22, 2024
1 parent b4083b8 commit f83e761
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
33 changes: 18 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ format:

.PHONY: logs
logs:
ssh root@172.104.148.60 cat log
ssh root@counter cat log

.PHONY: logs
get-newsletter-subscriptions:
ssh root@172.104.148.60 scripts/get-newsletter-subscriptions
ssh root@counter /state/scripts/get-newsletter-subscriptions

.PHONY: chgprodpwd
chgprodpwd:
ssh root@172.104.148.60 ''. .config/production.sh && python3 scripts/chgpwd.py $(user) $(password)
# .PHONY: chgprodpwd
# chgprodpwd:
# ssh root@counter ''. .config/production.sh && python3 scripts/chgpwd.py $(user) $(password)


.PHONY: chglocalpwd
chglocalpwd:
. .config/.sh && python3 scripts/chgpwd.py $(user) $(password)
# .PHONY: chglocalpwd
# chglocalpwd:
# . .config/.sh && python3 scripts/chgpwd.py $(user) $(password)

.PHONY: build
build:
Expand All @@ -50,21 +50,24 @@ buildlocal:
.PHONY: deploy
deploy:
make build
rsync .config webstats scripts [email protected]: -av
ssh [email protected] "pkill -x dtach; sleep 5; dtach -n /tmp/dtach ./scripts/prodrun"
rsync .config/makefile.env root@counter:/state/config/ -v
rsync .config/production.sh root@counter:/state/config/ -v
rsync scripts/* root@counter:/state/scripts/ -av
rsync webstats root@counter:/state/webstats
ssh root@counter "pkill -x dtach; sleep 5; dtach -n /tmp/dtach /state/scripts/prodrun"

.PHONY: redis-server
redis-server:
scp root@172.104.148.60:/var/lib/redis/dump.rdb /tmp/webstats-production.rdb
scp root@counter:/var/lib/redis/dump.rdb /tmp/webstats-production.rdb
plash --from alpine:$(alpineversion) --apk redis -- redis-server --dbfilename webstats-production.rdb --dir /tmp

.PHONY: log
log:
ssh root@172.104.148.60 tail log
ssh root@counter tail log

.PHONY: integrations
integrations:
ssh root@172.104.148.60 python3 scripts/integrations.py
ssh root@counter python3 /state/scripts/integrations.py


out/blog: templates/blog/* $(shell find content/posts)
Expand Down Expand Up @@ -100,8 +103,8 @@ out/help:
mkdir -p out/help

download-archives:
ssh root@172.104.148.60 cp /state/db/archive.db /tmp/archive.db
scp root@172.104.148.60:/tmp/archive.db /tmp/archive.db
ssh root@counter cp /state/db/archive.db /tmp/archive.db
scp root@counter:/tmp/archive.db /tmp/archive.db


# Snippset needed when setting counter.dev up in new servers
Expand Down
2 changes: 1 addition & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@


cd backend
exec env GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc CGO_ENABLED=1 \
# exec env GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc CGO_ENABLED=1 \
go build -a -ldflags '-linkmode external -extldflags "-static"' -o ../webstats
2 changes: 1 addition & 1 deletion scripts/prodrun
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

while true
do
. .config/production.sh && ./webstats
. /state/config/production.sh && /state/webstats
sleep 1
echo "died, restarting..."
done
Expand Down

0 comments on commit f83e761

Please sign in to comment.