Managevisor: New applications: Legacy documentation
To add new application, you need following information: * application name which is used as repo name, application name and usually as URL for app * whether application is manage application or not (has either manage login or uses RPC) * what google services are used (mysql, postgres, pubsub, own storage )
GitHub repository
Create GitHub repository under Attracs organization and set up webhook for CI
attracs-linux-playbooks:
./gcp/scripts/github/create_repo.sh (repo-name)
📘 Tip: If you get:
403 GithubException: You need admin access to the organization before adding a repository to it.
error, you need to create your own personal github token:
1. 1. Click your profile in Github ➝, settings ➝ developer settings ➝ tokens (classic)
2. Create a token with the following permissions:
1. Perm1
2. Perm2
2. 1. Copy the token, which is in the format ghp12356....
2. Decrypt the token file located in..TODO with ansible-vault decrypt and replace the the old token after ansible_token: with your own token.
1. Password is in 1Password
3. 1. Encrypt the token again with ansible-vault encrypt , using the password that you previously used to decrypt,
Webhook: Payload URL: https://ci.attracs.com/github/webhook Type: application/json Secret: - SSL: Enable Events: Branch or tag creation, Pushes
Give permissions to necessary teams in Github or create new team and add PM as maintainer.
Remember to put branch protection to newly created Github repository.
Define system wide port number
Add entries to services-excel, elect new port for app
[
docs.google.com
https://docs.google.com/spreadsheets/d/10trjuvrp_N8-OrqwsHchAysTIcrJRNqZ/edit?usp=sharing&ouid=103099631895570340638&rtpof=true&sd=true
](https://docs.google.com/spreadsheets/d/10trjuvrp_N8-OrqwsHchAysTIcrJRNqZ/edit?usp=sharing&ouid=103099631895570340638&rtpof=true&sd=true)
Create DNS entries
Add DNS entries via DNSMadeeasy (https://auth.dnsmadeeasy.com/)
attracs-linux-playbooks:
Stable:
./gcp/scripts/dns/create_cname_record.sh (hostname(cname)) (lbname(arecord))
Nightly
./gcp/scripts/dns/create_cname_record.sh (hostname(cname)-nightly) (lbname(arecord))
Arecord defines what LB will be used, so select one of these:
Usage: ./gcp/scripts/dns/create_cname_record.sh <recordname> <recordvalue>
Where <recordname> is host part and <recordvalue> lb name
Choose correct lb name from following list
attracs-devops -project:
devops-lb 34.98.96.99
attracs-services-195009
gcplb 34.120.86.122 (TMS)
lb2 34.120.155.57 (CORE+OTHERS)
att-nightly
lb1n 34.117.203.247 (TMS)
lb2n 35.244.240.9 (CORE+OTHERS)
attracs-logistics:
lb3 34.120.3.58 (ROAD)
ROAD CC LB:
road-cc-nightly-lb 34.144.248.151
road-cc-stable-lb 34.49.67.73
hetzner:
frontend 95.216.1.224 (ROAD OLD)
frontend 95.216.3.175 (ROAD OLD)
Create databases if applicable
- For MySQL
- Create user and database in Google Cloud Console
- revoke admin privileges
- add corresponding schema privileges (MySQL Workbench)
-
For Postgres
-
- Questions:
- What is db_variable_file?
- What service account should be used?
- Does it need to be created specifically for this?
- What permissions does it need to have?
- Does it need to be created specifically for this?
-
plain attracs-linux-playbooks: ./gcp/scripts/database/create_db_and_user.shUsage: plain ./gcp/scripts/database/create_db_and_user.sh <db-variable-file> <database-name> (<service_account>)By default, user is created as a postgres user, withAuthentication type: Built-in,name is copied from the database name that was given in the terminal command. If service_account is defined, user is created as a Cloud IAM user withAuthentication type: IAM (user). For service account, remove the gserviceaccount.com suffix For example:-
-
plain ./gcp/scripts/database/create_db_and_user.sh ./config/postgre/pg-databases-nightly-pg-1-nightly.yml test_database adi-eazytms-nightly@adi-eazytms-nightly.iamUse underscore in database names, for example palletlabels_nightly.
-
Use terraform to create infra (Git repository: adi-infra)
Use templates (https://github.com/Attracs/adi-infra/tree/main/terraform/gcp/templates) or copy from another project.
Create following structure:
projects/[app-name-folder]/[app-name-env]
For example:
projects/amc5/amc5-dev
projects/amc5/amc5-nightly
projects/ amc5/amc5-stable
Use application project for application specific configurations, for example: * service accounts (store keys to vault) * pubsub topics * Google Maps keys * application specific Cloud Storages Use common infra projects for: * Load Balancer/Cloud Armor configuration
Set up Hetzner loadbalancing if GCP is not used
Write frontend configuration to: https://github.com/Attracs/attracs-linux-playbooks/blob/master/frontend/frontend-data.yml
Push configuration to servers using:
./scripts/frontends-update-configs.sh
Create application configs
Create application config in attracs-application-configs repo * Store all secrets in Vault (https://vault.attracs.com/) * Push changes to Github and apply with attracs-linux-playbook
ansible-playbook vault_agent/vault_agent_config.yml --vault-password-file=.vault_password_file
Create application in Manage
Questions: When copying the main.go code block, which lines are necessary and which optional? * Which ones are organizations and which ones are apps? * In EmailDomains, what is a nightly domain? * If I don't have nightly, can i leave URLNightly out? * If I have to create an application with translations, where should I create the block? Do I write translation rows myself?
Create manage uuid for application
- Create uuid in https://www.uuidgenerator.net/
- Give uuid for developers to be added to main.go
- Add uuid to manage https://github.com/Attracs/attracs-manage/blob/master/server/main.go
- Deploy new nightly version or tag new stable version
- Run populate-apps from manage shell add new app
- Verify and enable application for selected organizations
- Enable application for developer -team in nightly
Build application
Build application manually to deploy nightly version. Stable versions will be tagged.
Set up and reload supervisor config
Create supervisord configs
- create process config to attracs-linux-playbooks: supervisord/run
- add process config to backends in attracs-linux-playbooks: supervisord/config/hosts
Update supervisor configurations
Supervisor: Updating Managevisor services (https://app.clickup.com/2496230/docs/2c5q6-69975/2c5q6-216715)
In managevisor
- reload corresponding backend configurations
- start processes
- Give access to developers to application in managevisor
- https://managevisor-nightly.attracs.com/ > teams > web team > (app)