Backend monolith for delphis
Note: To get service running locally, kick off enginx using the nginx/.../local.delphishq.com config. Also need to add mapping to /etc/hosts for local.delphishq.com
A few things you'll need to install. Assuming you're on mac:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install go
brew install nginx
brew install postgres@11
> CREATE DATABASE chatham_local;
> CREATE USER chatham_local;
> CREATE ROLE chatham_app;
> GRANT usage ON SCHEMA public TO chatham_app;
> GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public to chatham_app;
> GRANT chatham_app TO chatham_local;
psql -U chatham_local -d chatham_local -f _scripts/migrations/000....sql
make setup-internal-dep
/etc/hosts
that looks like 127.0.0.1 local.delphishq.com
. This is required for cookie management (cookies don't like localhost).export DELPHIS_TWITTER_CONSUMER_KEY=xxxxx
export DELPHIS_TWITTER_CONSUMER_SECRET=xxxxx
export DELPHIS_AUTH_HMAC_SECRET=xxxxx
make local-nginx
go run server.go
Okay at this point you should have the local server up and running. It has no data so let's do that:
http://local.delphishq.com:8000/twitter/login
. This will actually log you in via twitter.http://local.delphishq.com:8000/graphiql
and enter the following code:
mutation createDiscussion{
createDiscussion(anonymityType:WEAK){
id
}
}
query listDiscussions{
listDiscussions{
id
moderator{
userProfile{
twitterURL{
url
}
}
}
}
}
This should show your name as the moderator.
cd ./delphis-demo
and run yarn start
. This should start the local app and allow you to navigate to http://local.delphishq.com:8000/
.And you're done!
1) Install Mockery via go get -u github.com/vektra/mockery/.../
.
Retrieve credentials, build image, tag image, and push image.
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 033236388136.dkr.ecr.us-west-2.amazonaws.com/delphisbe
docker build -t delphisbe .
docker tag delphisbe:latest 033236388136.dkr.ecr.us-west-2.amazonaws.com/delphisbe:latest
docker push 033236388136.dkr.ecr.us-west-2.amazonaws.com/delphisbe:latest
I had to do the following:
> CREATE USER chatham_staging WITH PASSWORD <REDACTED>;
> CREATE ROLE chatham_app;
> GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public to chatham_app;
> GRANT chatham_app TO chatham_staging;
Setup the jumpbox:
Host delphis-bastion-db
HostName ec2-34-208-84-118.us-west-2.compute.amazonaws.com
IdentityFile /Users/ned/.ssh/delphis-keypair.pem
LocalForward 3333 chatham-staging-aurora-pgsql.cluster-cgw5uhmof8wi.us-west-2.rds.amazonaws.com:5432
User ec2-user
and kick it off. Then use localhost:3333
for the database.
Please run terraform using these commands. This will leverage the S3 backend.
AWS_PROFILE=delphis make plan env=staging
AWS_PROFILE=delphis make apply env=staging