Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cd #41

Merged
merged 21 commits into from
Apr 15, 2022
Merged

Feature/cd #41

merged 21 commits into from
Apr 15, 2022

Conversation

leihuayi
Copy link
Contributor

Partie CD de la CI/CD
WORK IN PROGRESS: ne pas merger.

@github-actions github-actions bot added the feature New feature / functionality label Mar 28, 2022
default: "latest"
branch:
required: false
description: "Branch to pull in instance deployment"
Copy link
Contributor Author

@leihuayi leihuayi Apr 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a branch in addition to the pre-built docker images ? see the comment in deployment script

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cf. bellow

required: false
description: "Size in GB of instance"
type: number
default: 10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it changes the price we can lower up to 5 GB (currently backend image is ~2GB and frontend ~30MB)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to repeat te default for variables like volume_size, branch, since they are already in cd/terraform/variable.tf ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how is the pricing for volume boot instance.

For defaults values, is more documentation than real defaults values.

required: false
type: string
description: "Flavor of instance"
default: "s1-2"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is a sandbox flavor, I have no knowledge on this, why chose this flavor in particular ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only for test, we can change this flavor

export APP_URL="https://github.com/${ORG}/${APP_NAME}/archive/refs/heads/${APP_BRANCH}.tar.gz"
export USER=$(lsb_release -si | tr [:upper:] [:lower:])

cd /home/$USER && mkdir -p ${APP_NAME} && curl -kLs $APP_URL \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I understand well

  • we download the entire code of Basegun repo
  • for branch ${APP_BRANCH}

why not:

  • only download the files we need (Makefile, maybe docker-compose)
  • use the branch with tag ${VERSION} ?(if version==latest we try to find which tag it is ?) it seems logical that the Makefile & docker-compose should be issued from same version as the docker images we are going to pull

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we download the entire code of Basegun for not hardcoding download docker-compose and makefile. Then, github prepare the repo archive natively.

For version, yes, it can be better.

cd/scripts/deploy.sh Show resolved Hide resolved
- chmod +x /usr/bin/docker-compose

final_message: "The system is finally up, after $UPTIME seconds"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very neat 👍

OS_USERNAME: ${{ secrets.OS_USERNAME }}
OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
OS_PROJECT_ID: ${{ secrets.OS_PROJECT_ID }}
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the username/passwd for an ovh account right ? We said we should create a "deployment" user in these secrets rather than my credentials if I remeber correctly ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the services user is created on OVH. Now, we need to add this creds on github secrets.

required: false
description: "Size in GB of instance"
type: number
default: 10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to repeat te default for variables like volume_size, branch, since they are already in cd/terraform/variable.tf ?

name = var.image
most_recent = true
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not too complex (or too costy), we would appreciate have a s3 volume mounted as well. I don't know how that works, I would be happy to discuss about it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's can be a good issue! I don't know how that is possible.


variable "app" {
type = string
default = "basegun"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's with a capital B, "Basegun"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tar -zxvf - --strip-components=1 -C ${APP_NAME} fix this issue

@@ -0,0 +1,8 @@

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when is this executed ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is show after deployment in CI's logs

@leihuayi leihuayi changed the title WIP - Feature/cd Feature/cd Apr 15, 2022
@leihuayi leihuayi merged commit decbf21 into develop Apr 15, 2022
@leihuayi leihuayi deleted the feature/cd branch April 21, 2022 15:54
@leihuayi leihuayi linked an issue May 9, 2022 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature / functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create CI/CD for project
2 participants