Create code repositories
As a developer, you'll need a Git repository for your code. Most organizations will probably use a Git service like GitLab or GitHub. But if you don't, you can use the integrated Git service powered by Gitea.
As a Team member, you can create and manage your own repositories.
Team members first have to sign in to Gitea (using OpenID), after which they are automatically granted access to the team's organization in Gitea.
The default
platform-admin
account does not have access to team organizations in Gitea. When using theplatform-admin
account, make sure to add your account to the Owners group of the Team's organization in Gitea.
In the labs, we'll be using a team called labs and a user called labs-user@labs.com
.
Create the private repository (blue)
In the apps section in the console, you'll see an app called Gitea. Click on it.
-
Navigate to the Apps page using the left menu and click on the Gitea app.
-
Create a new repository. To do this, you can click the + dropdown menu in the top right and select New repository.
-
Select team-labs as the owner. This is the team that you belong to as a member.
-
Enter blue as the repository name.
-
Check the Make Repository Private checkbox.
-
Scroll further down the page and check the Initialize repository checkbox. This adds a README file, license file, and
.gitignore
file to the new repository. -
Click the Create Repository button at the bottom to continue.
Your repo is now ready to be used.
Add initial files
Add the following wo files to the repository:
-
Dockerfile
:FROM nginxinc/nginx-unprivileged:stable COPY blue.html /usr/share/nginx/html/index.html EXPOSE 8080
-
blue.html
:<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Sample Deployment</title> <style> body { color: #ffffff; background-color: blue; font-family: Arial, sans-serif; font-size: 14px; } h1 { font-size: 500%; font-weight: normal; margin-bottom: 0; } h2 { font-size: 200%; font-weight: normal; margin-bottom: 0; } .centered-text { text-align: center; } </style> </head> <body> <div class="centered-text"> <h1>Welcome to Blue</h1> </div> </body> </html>
Repeat the steps for the green repository
In the upcoming labs we are going to use the blue repository, but we'll also need a green repository.
Create the green repository and add the same two files that where added to the blue repo, making the following changes:
-
When creating the repository, set the repository name to green.
-
When adding the files, change the file name to
green.html
, replaceBlue
in the h1 heading withGreen
, and set thebackground-color
of the body element in the css styles togreen
.<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Sample Deployment</title> <style> body { color: #ffffff; background-color: green; font-family: Arial, sans-serif; font-size: 14px; } h1 { font-size: 500%; font-weight: normal; margin-bottom: 0; } h2 { font-size: 200%; font-weight: normal; margin-bottom: 0; } .centered-text { text-align: center; } </style> </head> <body> <div class="centered-text"> <h1>Welcome to Green</h1> </div> </body> </html>
Now continue with the next lab to register the code repositories in App Platform.
Updated 1 day ago