Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6f020ff48 | ||
|
|
d9ddfaf2cc | ||
|
|
03e6f069c9 | ||
|
|
d876f4ced9 | ||
|
|
68a02e2f24 |
@@ -33,7 +33,6 @@ jobs:
|
|||||||
uses: battila7/get-version-action@v2.0.0
|
uses: battila7/get-version-action@v2.0.0
|
||||||
|
|
||||||
- name: Build, tag, and push image to Amazon ECR
|
- name: Build, tag, and push image to Amazon ECR
|
||||||
id: build-image
|
|
||||||
env:
|
env:
|
||||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||||
ECR_REPOSITORY: goff
|
ECR_REPOSITORY: goff
|
||||||
@@ -43,20 +42,3 @@ jobs:
|
|||||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||||
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
||||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
||||||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
|
|
||||||
|
|
||||||
- name: Fill in the new image ID in the Amazon ECS task definition
|
|
||||||
id: task-def
|
|
||||||
uses: aws-actions/amazon-ecs-render-task-definition@v1
|
|
||||||
with:
|
|
||||||
task-definition: task-definition.json
|
|
||||||
container-name: "goff"
|
|
||||||
image: ${{ steps.build-image.outputs.image }}
|
|
||||||
|
|
||||||
- name: Deploy Amazon ECS task definition
|
|
||||||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
|
|
||||||
with:
|
|
||||||
task-definition: ${{ steps.task-def.outputs.task-definition }}
|
|
||||||
service: "goff"
|
|
||||||
cluster: "discord-bots"
|
|
||||||
wait-for-service-stability: true
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ func addTagCommandFunc(ctx disgoman.Context, input []string) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = services.UserService.CreateUser(&goff.User{ID: ctx.User.ID}, ctx.Guild.ID)
|
err = services.UserService.CreateUser(&goff.User{ID: ctx.User.ID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error creating user %s: %s", ctx.User.ID, err.Error())
|
log.Printf("Error creating user %s: %s", ctx.User.ID, err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func OnGuildMemberAdd(s *discordgo.Session, member *discordgo.GuildMemberAdd) {
|
|||||||
IsStaff: false,
|
IsStaff: false,
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
}
|
}
|
||||||
err := services.UserService.CreateUser(user, member.GuildID)
|
err := services.UserService.CreateUser(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error adding user to database: ", err)
|
log.Println("Error adding user to database: ", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,13 +36,10 @@ func (s *UserService) User(id string) (*goff.User, error) {
|
|||||||
return &u, nil
|
return &u, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *UserService) CreateUser(u *goff.User, gid string) error {
|
func (s *UserService) CreateUser(u *goff.User) error {
|
||||||
queryString := `INSERT INTO users (id, banned, logging, steam_id, is_active, is_staff, is_admin)
|
queryString := `INSERT INTO users (id, banned, logging, steam_id, is_active, is_staff, is_admin)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT DO NOTHING`
|
VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT (id) DO NOTHING`
|
||||||
_, err := s.DB.Exec(queryString, u.ID, u.Banned, u.Logging, u.SteamID, u.IsActive, u.IsStaff, u.IsAdmin)
|
_, err := s.DB.Exec(queryString, u.ID, u.Banned, u.Logging, u.SteamID, u.IsActive, u.IsStaff, u.IsAdmin)
|
||||||
if err == nil {
|
|
||||||
err = s.AddUserToGuild(u, &goff.Guild{ID: gid})
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +59,7 @@ func (s *UserService) MarkUserInactive(u *goff.User) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *UserService) AddUserToGuild(u *goff.User, g *goff.Guild) error {
|
func (s *UserService) AddUserToGuild(u *goff.User, g *goff.Guild) error {
|
||||||
queryString := `INSERT INTO x_users_guilds (user_id, guild_id) VALUES ($1, $2) ON CONFLICT DO NOTHING`
|
queryString := `INSERT INTO x_users_guilds (user_id, guild_id) VALUES ($1, $2)`
|
||||||
_, err := s.DB.Exec(queryString, u.ID, g.ID)
|
_, err := s.DB.Exec(queryString, u.ID, g.ID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,134 +0,0 @@
|
|||||||
{
|
|
||||||
"ipcMode": null,
|
|
||||||
"executionRoleArn": "arn:aws:iam::005692590034:role/goff_ecs_rds+cw+ecr",
|
|
||||||
"containerDefinitions": [
|
|
||||||
{
|
|
||||||
"dnsSearchDomains": null,
|
|
||||||
"environmentFiles": null,
|
|
||||||
"logConfiguration": {
|
|
||||||
"logDriver": "awslogs",
|
|
||||||
"secretOptions": null,
|
|
||||||
"options": {
|
|
||||||
"awslogs-group": "/ecs/goff",
|
|
||||||
"awslogs-region": "us-east-1",
|
|
||||||
"awslogs-stream-prefix": "ecs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"entryPoint": null,
|
|
||||||
"portMappings": [],
|
|
||||||
"command": null,
|
|
||||||
"linuxParameters": null,
|
|
||||||
"cpu": 0,
|
|
||||||
"environment": [],
|
|
||||||
"resourceRequirements": null,
|
|
||||||
"ulimits": null,
|
|
||||||
"dnsServers": null,
|
|
||||||
"mountPoints": [],
|
|
||||||
"workingDirectory": null,
|
|
||||||
"secrets": [
|
|
||||||
{
|
|
||||||
"valueFrom": "goff_database_uri",
|
|
||||||
"name": "DATABASE_URL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"valueFrom": "goff_discord_token",
|
|
||||||
"name": "DISCORDGO_TOKEN"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"valueFrom": "goff_email_password",
|
|
||||||
"name": "GOFF_EMAIL_PASSWORD"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"valueFrom": "goff_email_username",
|
|
||||||
"name": "GOFF_EMAIL_USERNAME"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dockerSecurityOptions": null,
|
|
||||||
"memory": 512,
|
|
||||||
"memoryReservation": null,
|
|
||||||
"volumesFrom": [],
|
|
||||||
"stopTimeout": null,
|
|
||||||
"image": "005692590034.dkr.ecr.us-east-1.amazonaws.com/goff:latest",
|
|
||||||
"startTimeout": null,
|
|
||||||
"firelensConfiguration": null,
|
|
||||||
"dependsOn": null,
|
|
||||||
"disableNetworking": null,
|
|
||||||
"interactive": null,
|
|
||||||
"healthCheck": null,
|
|
||||||
"essential": true,
|
|
||||||
"links": null,
|
|
||||||
"hostname": null,
|
|
||||||
"extraHosts": null,
|
|
||||||
"pseudoTerminal": null,
|
|
||||||
"user": null,
|
|
||||||
"readonlyRootFilesystem": null,
|
|
||||||
"dockerLabels": null,
|
|
||||||
"systemControls": null,
|
|
||||||
"privileged": null,
|
|
||||||
"name": "goff"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"placementConstraints": [],
|
|
||||||
"memory": "512",
|
|
||||||
"taskRoleArn": "arn:aws:iam::005692590034:role/goff_ecs_rds+cw+ecr",
|
|
||||||
"compatibilities": [
|
|
||||||
"EC2"
|
|
||||||
],
|
|
||||||
"taskDefinitionArn": "arn:aws:ecs:us-east-1:005692590034:task-definition/goff:2",
|
|
||||||
"family": "goff",
|
|
||||||
"requiresAttributes": [
|
|
||||||
{
|
|
||||||
"targetId": null,
|
|
||||||
"targetType": null,
|
|
||||||
"value": null,
|
|
||||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"targetId": null,
|
|
||||||
"targetType": null,
|
|
||||||
"value": null,
|
|
||||||
"name": "ecs.capability.execution-role-awslogs"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"targetId": null,
|
|
||||||
"targetType": null,
|
|
||||||
"value": null,
|
|
||||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"targetId": null,
|
|
||||||
"targetType": null,
|
|
||||||
"value": null,
|
|
||||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"targetId": null,
|
|
||||||
"targetType": null,
|
|
||||||
"value": null,
|
|
||||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"targetId": null,
|
|
||||||
"targetType": null,
|
|
||||||
"value": null,
|
|
||||||
"name": "ecs.capability.execution-role-ecr-pull"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"targetId": null,
|
|
||||||
"targetType": null,
|
|
||||||
"value": null,
|
|
||||||
"name": "ecs.capability.secrets.ssm.environment-variables"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pidMode": null,
|
|
||||||
"requiresCompatibilities": [
|
|
||||||
"EC2"
|
|
||||||
],
|
|
||||||
"networkMode": null,
|
|
||||||
"cpu": "1024",
|
|
||||||
"revision": 2,
|
|
||||||
"status": "ACTIVE",
|
|
||||||
"inferenceAccelerators": null,
|
|
||||||
"proxyConfiguration": null,
|
|
||||||
"volumes": []
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ type User struct {
|
|||||||
|
|
||||||
type UserService interface {
|
type UserService interface {
|
||||||
User(id string) (*User, error)
|
User(id string) (*User, error)
|
||||||
CreateUser(u *User, gid string) error
|
CreateUser(u *User) error
|
||||||
DeleteUser(u *User) error
|
DeleteUser(u *User) error
|
||||||
MarkUserInactive(u *User) error
|
MarkUserInactive(u *User) error
|
||||||
AddUserToGuild(u *User, g *Guild) error
|
AddUserToGuild(u *User, g *Guild) error
|
||||||
|
|||||||
Reference in New Issue
Block a user