Compare commits
No commits in common. "master" and "k8s-deploy" have entirely different histories.
master
...
k8s-deploy
@ -1 +0,0 @@
|
|||||||
Dockerfile
|
|
19
.drone.yml
19
.drone.yml
@ -1,19 +0,0 @@
|
|||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
type: docker
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: deploy
|
|
||||||
image: v4l3n71n/covas:latest
|
|
||||||
pull: if-not-exists
|
|
||||||
commands:
|
|
||||||
- eval $(ssh-agent -s)
|
|
||||||
- id -u ansible
|
|
||||||
- sshpass -p 50ford5080850 ssh-add ssh_keys/id_rsa_nas
|
|
||||||
- sshpass -p 23v4l3n71n02cz3ry841993 ssh-add ssh_keys/id_rsa_vps
|
|
||||||
- ansible-playbook -i inventory --syntax-check playbook.yml
|
|
||||||
- ansible --ask-vault-password -i inventory -m ping playbook.yml
|
|
||||||
|
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- dockerconfig
|
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
ssh_keys/
|
|
@ -1,9 +0,0 @@
|
|||||||
FROM debian:bookworm-slim
|
|
||||||
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes python3 python3-pip openssh-client sshpass && rm -rf /var/lib/apt/lists/*
|
|
||||||
RUN groupadd -r ansible && useradd -m -r -g ansible ansible
|
|
||||||
USER ansible
|
|
||||||
RUN pip install ansible
|
|
||||||
WORKDIR /home/ansible
|
|
||||||
ENV PATH="${PATH}:/home/ansible/.local/bin"
|
|
||||||
COPY --chown=ansible:ansible . /home/ansible
|
|
||||||
RUN ansible-galaxy install -vvvv -r requirements.yml
|
|
@ -1,4 +1,3 @@
|
|||||||
msg: db
|
|
||||||
postgres_url: db.valczeryba.ovh
|
postgres_url: db.valczeryba.ovh
|
||||||
postgres_db: toto
|
postgres_db: toto
|
||||||
postgres_port: 54321
|
postgres_port: 54321
|
||||||
@ -11,17 +10,13 @@ project_directory:
|
|||||||
- "{{ project_src }}"
|
- "{{ project_src }}"
|
||||||
- "{{ project_src }}/{{ project_name }}"
|
- "{{ project_src }}/{{ project_name }}"
|
||||||
|
|
||||||
docker_compose_file: "docker-compose-db.yml.j2"
|
docker_compose_file: "docker-compose-db.yml"
|
||||||
|
|
||||||
project_env: "env-db.j2"
|
project_env: "env-db.j2"
|
||||||
|
|
||||||
redis_url: redis.valczeryba.ovh
|
redis_url: redis.valczeryba.ovh
|
||||||
redis_port: 63791
|
redis_port: 63791
|
||||||
|
|
||||||
mongo_port: 28017
|
|
||||||
ports_tcp:
|
ports_tcp:
|
||||||
- "{{ postgres_port }}"
|
- "{{ postgres_port }}"
|
||||||
- "{{ redis_port }}"
|
- "{{ redis_port }}"
|
||||||
- "{{ mongo_port }}"
|
|
||||||
|
|
||||||
covas_liquibase: false
|
|
@ -1,17 +1,14 @@
|
|||||||
$ANSIBLE_VAULT;1.1;AES256
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
64653663303437333433396331636461353737313832366539353264623561393761666464316363
|
30326462626436373330386637633864316430623235306239353439313932383964646435393965
|
||||||
3633613637663530383739353830366662646461653138650a663939373238663737363737353535
|
3662326631306134363862626638616330633765666538360a323264646135393935343434343362
|
||||||
65313433373565343830396230656162663361366265363131323961353764333462386464376239
|
36666566316465383833386433623565373837353233366435346633313566623361653937306336
|
||||||
3662656464633566310a616331653331383631343065396537333338353738353865636539396533
|
6362383331643665300a393561643837376461326663663235343434363438623637306263626163
|
||||||
63333436663739346231626139316265643438393739383761383033616465613964643830643033
|
38336162383331383732643765323763656130653432386534376335336338663663363439666361
|
||||||
66336237303833616638636336393739326332623738393032646561376564343835353533366632
|
31306530666264323130333561356564626536643533356337383631613534383730666338313664
|
||||||
64633239656639303063653538396562393366396137316530633638333539333631343238376463
|
34626261616430623063323836616130383335383965326239636362616531623565323734613532
|
||||||
62366463393234663834616639633635303537633565636634383435363663336363386238646563
|
33313830663666633432666135346234643834316239633132383862393636623230316532616365
|
||||||
32633634323332393765343933313666333134346132636637383233633064383663323531333834
|
30336564306336393064613330336436363631316236353237343838396637353735356461323331
|
||||||
61366334633532653430326266623366353761626330386439626437623266316636633235326263
|
34343637336532373539663565666337383837373235613734303831376636303361376533346333
|
||||||
33393233313463656335353639633262623335633336613030633435363232316632313031663034
|
32316430613936366464383832376237633036353737353566613638396236316664356638373635
|
||||||
34366130346135336365376332383637343761303435623138613533393561613039353561663866
|
35303239353937316236323339633335373761623032313231383937306236303861306265646333
|
||||||
66636139323138376566643239383563363738363130373735653365363133303864386462333065
|
65633638623065303761646562373936336235373533333265643534616663343538
|
||||||
63623934623032353638643034363439616333646530306430346461393264323661376335393366
|
|
||||||
62656639633339303536643535383035383964623761386166373135323465663132323262663961
|
|
||||||
39313365616266333636
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
drone_gitea_server: https://git.valczeryba.ovh
|
|
||||||
drone_server_host: drone.valczeryba.ovh:8000
|
|
||||||
drone_agents_enabled: true
|
|
||||||
drone_server_proto: http
|
|
||||||
drone_tls_autocert: false
|
|
||||||
drone_open: false
|
|
||||||
drone_host: http://localhost:8000
|
|
||||||
drone_rpc_server: drone-server:8000
|
|
||||||
|
|
||||||
msg: drone
|
|
||||||
|
|
||||||
project_src: "/home/valentin/drone"
|
|
||||||
|
|
||||||
project_directory:
|
|
||||||
- "{{ project_src }}"
|
|
||||||
|
|
||||||
project_env: env-drone.j2
|
|
||||||
docker_compose_file: "docker-compose-drone.yml.j2"
|
|
||||||
|
|
||||||
ports_tcp:
|
|
||||||
- 8000
|
|
||||||
- 9000
|
|
@ -1,18 +0,0 @@
|
|||||||
$ANSIBLE_VAULT;1.1;AES256
|
|
||||||
38303932316262306464333166316363643239366561323234643563623362336335613237376239
|
|
||||||
3535393466323064333163363932663731663031663933350a323431653239396663343666373765
|
|
||||||
31373066383234303139663135326462613539626363373930346366383831646536316465373563
|
|
||||||
3537653761373233300a383637623932616663393763643066326238633932643730336339336330
|
|
||||||
38366430336561613866373634313130616438313234666431396638366161613839303864353561
|
|
||||||
35613234326539383765666637323236303161623061633164646430663834393764623931656638
|
|
||||||
63336533383065343738373564393266653738656163643165383434623836666434646337336565
|
|
||||||
32373261636363396363343236353336306331313761623531653834346536353039656564316138
|
|
||||||
66643166653435666162383333366233353165393837303539646538353765653465363532346231
|
|
||||||
65633365353131613437623663313934626461313437373730623164636364393362366537373162
|
|
||||||
62363965323662356638633661363236326437353366356134346333313466323139336362363234
|
|
||||||
62376262346338643339363566303339366165636566623565363238363736646637646635303531
|
|
||||||
38343031666635323539353431316164353830363838313662613063616532623730346561333665
|
|
||||||
33316137613666636439383364353735653535346537383831323333646238356534393935643435
|
|
||||||
31643637323366616230633039336633313631316330323064306638663039393330376366633930
|
|
||||||
65643861363231313033333662396339636432343133336561356438636233643762313539323166
|
|
||||||
6261
|
|
@ -1,20 +1,4 @@
|
|||||||
project_terraform: "/home/valentin/terraform"
|
project_terraform: "/home/valentin/terraform"
|
||||||
project_backend: "/home/valentin/k8s_backend"
|
|
||||||
project_kubeconfig: "/home/valentin/.kube/config"
|
|
||||||
region_k8s: "fr-par"
|
region_k8s: "fr-par"
|
||||||
project_name_tf: "terraform-test"
|
project_name: "terraform-test"
|
||||||
quarkus_project: "covas-quarkus"
|
quarkus_project: "covas-quarkus"
|
||||||
|
|
||||||
mailer_host: "smtp.gmail.com"
|
|
||||||
mailer_from: "valczebackup@gmail.com"
|
|
||||||
mailer_port: "587"
|
|
||||||
|
|
||||||
port: 8083
|
|
||||||
targetPort: 8080
|
|
||||||
|
|
||||||
|
|
||||||
backend_yaml:
|
|
||||||
- backend-deployment
|
|
||||||
- backend-service
|
|
||||||
- env-configmap
|
|
||||||
- secret
|
|
@ -1,46 +1,10 @@
|
|||||||
$ANSIBLE_VAULT;1.1;AES256
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
30356465363432393266326366393162306331353564346565663139336538613832396135306537
|
38396665356139383861356137373362393834373765663937373730333434356565383864333137
|
||||||
6262336438613736636266623766333233336631656661640a663838373936613666373133383632
|
3763386361323938326462393632346565386432336531620a616261656133323236343464303837
|
||||||
32613962623330303964333161373165363164646266396461633233346136336630646631306564
|
39613966333435393336396361666337306438393138363961336462383666326363326439373762
|
||||||
3939363432643961610a313338306136303132666461393637643235623361393830653534643137
|
6139623462323133330a646432336365666164643435383430616137313130646137623463373636
|
||||||
38623038613364396538353533336631633863343834333030653164303231346263316435356231
|
32313561383838366437633634376434616438633665363465626633633537383435616537336339
|
||||||
61383966663834333662393138303035613330366533663037326532356332633839363763356466
|
64313836613730613135363739363536356362373762313431353938653738613666313966393163
|
||||||
63396536323864383933346434363231396164613838316162656333626634373936643738386565
|
33336234363964633633663431353966666530353432643461656336356166393837316634313164
|
||||||
32326532346334343666383632306264636132613266333863626462366530306439613130333564
|
65653033636338363563666363326433636163323363656530323834303464356136346163353466
|
||||||
38623461613739343461386564323865316332653530623862313163396566616230653030653266
|
3533
|
||||||
61613836303231363534393531373233363332316639316137653132336638356161333764373562
|
|
||||||
34363034353935633437353466303364653039626137383534633239316563373663623030646330
|
|
||||||
38383639326563643266346530616666646337373765643336326536303864613363663536643465
|
|
||||||
34343663373131323437666462303763366439356362306337356131383932353731393935343931
|
|
||||||
32613333373439343864653864636438646431306637613038313061663961653033643465643864
|
|
||||||
31333366663037373835326330316535326134393761333662326665333464666164623336666439
|
|
||||||
35313066303830343737343063396335383461653338303734353461643736343163346565323864
|
|
||||||
65356437376663386535646437653566326532346462313932346435393730366530646164323537
|
|
||||||
35363633333065356162653762623239343836356230303734316130383234313536623339626531
|
|
||||||
36643434336233626234333235636566313566353939616433373465666362316663353336653162
|
|
||||||
32346534333665353934653738343335356137643539376639323164393837383065323436363064
|
|
||||||
35643762656365313261373030336339616266333765613735346565623138366533626335633033
|
|
||||||
38373732626337353535656230636235373535363332376535343162666266393931303236653631
|
|
||||||
33653432633337306230396434316230663438363630313038386538663732393863633837313638
|
|
||||||
31663763303462343063613638663361626462623035336465383661646433643833636361346236
|
|
||||||
32386263326664363338633861643264383462313863666662623033323761613132666130353235
|
|
||||||
34633261303761623033633964323862666137333035306333323932346334356365333563316630
|
|
||||||
34313263306561303538353134613233313337323636623230616532383133613561333439663337
|
|
||||||
64376230363038306238656236653366353738633436623330383239373062313831393066313838
|
|
||||||
38653532356632383765613530373034396639633064383336393934353061656266633463336333
|
|
||||||
66356538616233313936376565386432303134306363343734333563333266643062666231303532
|
|
||||||
37363664396165653333656661376334333432376566666237316232643234386332323936346630
|
|
||||||
63303563363162356666643732366131393066333838363935613336353062633862353838613761
|
|
||||||
64333939663733643132366334653835633733623539393735313961613131303934363731663231
|
|
||||||
64313434613934336630306165343665376261353562656634356365613137346232633431343734
|
|
||||||
63363532313765646434346132313434373366656332353133383530306639633062633365613932
|
|
||||||
65383865643262666666383933363534623838653661376531303763623261323937626335373635
|
|
||||||
32623262343130383462316462643338363433653133353737633562353330313533303835666634
|
|
||||||
65386336616466316663356236316466353164353139326333316362303737343335353731366531
|
|
||||||
36653062323764316332353136343738616338313465333261363664663934393038343237313135
|
|
||||||
64363036636634646137616365366538613338343761646137623432396539363035663031313464
|
|
||||||
66646663373838316161643161613838343139346165663331373334383334316562353235633461
|
|
||||||
65316666616334653034393165616434306664633336613639636433663761363932396663396630
|
|
||||||
64383961623136623639306435663965303632663039653538646463663235653333306434313931
|
|
||||||
32636536643536636561663534346633663464333830646139383939626665393964353739616435
|
|
||||||
35663834393738646130316564633966653765303033356132393961653831646362
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
$ANSIBLE_VAULT;1.1;AES256
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
61643965343735653231363764646132363434653530346532343765663036376434353334356330
|
35333863396561393462653263323133343233346534616138616530643066323161656534653738
|
||||||
6133383634643439353338383039653234303666306661350a636366343465356639646535663234
|
3335306466663636623236383435663337393466633437660a303961663331653463343933353966
|
||||||
31356434363130663961653638363463333330346561333933643263643362343132376131313764
|
35636161393663386137306561613965653438626432323865323233636662653333616532636665
|
||||||
3439663335386235610a396435303138666166383363303038663163393538323362313965613933
|
3562333936366238640a646262373233363665366437653032303238313266356138343239303936
|
||||||
65666338653533386234336365316664313266326130313064653864386235323461303938386333
|
36663531303061663763653637333365303664666563353631303435633462343537
|
||||||
3239646561363831643530633466613035643630363761326666
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
msg: registry
|
|
||||||
project_src: "/home/valentin/registry"
|
project_src: "/home/valentin/registry"
|
||||||
|
|
||||||
project_directory:
|
project_directory:
|
||||||
- "{{ project_src }}"
|
- "{{ project_src }}"
|
||||||
|
|
||||||
|
docker_compose_file: "docker-compose-registry.yml"
|
||||||
docker_compose_file: "docker-compose-registry.yml.j2"
|
|
||||||
|
|
||||||
|
|
||||||
ports_tcp:
|
ports_tcp:
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
vps-host ansible_connection=ssh ansible_host=51.222.107.37 ansible_port=2424 ansible_user=valentin
|
vps ansible_connection=ssh ansible_host=51.222.107.37 ansible_port=2424 ansible_user=valentin
|
||||||
valentin-nas ansible_connection=ssh ansible_host=151.80.37.38 ansible_port=2424 ansible_user=valentin
|
valentin-nas ansible_connection=ssh ansible_host=151.80.37.38 ansible_port=2424 ansible_user=valentin
|
||||||
drone-host ansible_connection=ssh ansible_host=151.80.37.38 ansible_port=2424 ansible_user=valentin
|
localhost ansible_host=127.0.0.1
|
||||||
localhost ansible_host=127.0.0.1 ansible_python_interpreter=/usr/bin/python3.10
|
|
||||||
|
|
||||||
[vps]
|
[db]
|
||||||
vps-host
|
|
||||||
|
|
||||||
[db:children]
|
|
||||||
local
|
|
||||||
vps
|
vps
|
||||||
|
localhost
|
||||||
|
|
||||||
[db_vault:children]
|
[db_vault:children]
|
||||||
db
|
db
|
||||||
@ -16,16 +12,8 @@ db
|
|||||||
[nas]
|
[nas]
|
||||||
valentin-nas
|
valentin-nas
|
||||||
|
|
||||||
|
[registry:children]
|
||||||
[registry]
|
nas
|
||||||
valentin-nas
|
|
||||||
|
|
||||||
|
|
||||||
[drone]
|
|
||||||
drone-host
|
|
||||||
|
|
||||||
[drone_vault:children]
|
|
||||||
drone
|
|
||||||
|
|
||||||
[nas_vault:children]
|
[nas_vault:children]
|
||||||
nas
|
nas
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
---
|
---
|
||||||
- hosts: registry vps
|
- hosts: registry db
|
||||||
remote_user: valentin
|
remote_user: valentin
|
||||||
roles:
|
roles:
|
||||||
- server
|
- server
|
||||||
|
|
||||||
|
|
||||||
- hosts: local
|
- hosts: local
|
||||||
remote_user: valentin
|
remote_user: valentin
|
||||||
roles:
|
roles:
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
collections:
|
/home/valentin/.ansible/collections/ansible_collections:
|
||||||
|
community.docker:
|
||||||
|
version: 3.1.0
|
||||||
|
/usr/lib/python3.10/site-packages/ansible_collections:
|
||||||
amazon.aws:
|
amazon.aws:
|
||||||
version: 3.4.0
|
version: 3.4.0
|
||||||
ansible.netcommon:
|
ansible.netcommon:
|
||||||
|
@ -1 +0,0 @@
|
|||||||
ovh
|
|
@ -27,34 +27,4 @@
|
|||||||
- name: Template env file
|
- name: Template env file
|
||||||
template:
|
template:
|
||||||
src: "env-build.j2"
|
src: "env-build.j2"
|
||||||
dest: "{{ home_dir }}/{{ quarkus_project }}/.env"
|
dest: "{{ home_dir }}/{{ quarkus_project }}/.env"
|
||||||
|
|
||||||
- name: Pause for build image
|
|
||||||
pause:
|
|
||||||
prompt: aller au dossier {{ home_dir }}/{{ quarkus_project }}, et exécuter le script build-image.sh
|
|
||||||
|
|
||||||
- name: Get quarkus image
|
|
||||||
docker_image_info:
|
|
||||||
name: quarkus-native
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Check quarkus image
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.images | length == 1
|
|
||||||
|
|
||||||
- name: Login to scaleway registry
|
|
||||||
docker_login:
|
|
||||||
registry_url: rg.fr-par.scw.cloud/covas
|
|
||||||
username: nologin
|
|
||||||
password: "{{ token_scaleway }}"
|
|
||||||
reauthorize: true
|
|
||||||
|
|
||||||
|
|
||||||
- name: Tag and push to custom registry
|
|
||||||
docker_image:
|
|
||||||
name: quarkus-native
|
|
||||||
repository: rg.fr-par.scw.cloud/covas/quarkus-native
|
|
||||||
tag: latest
|
|
||||||
push: yes
|
|
||||||
source: local
|
|
@ -11,6 +11,7 @@
|
|||||||
src: main.tf.j2
|
src: main.tf.j2
|
||||||
dest: "{{ project_terraform }}/main.tf"
|
dest: "{{ project_terraform }}/main.tf"
|
||||||
|
|
||||||
|
|
||||||
- name: Create cluster scaleway
|
- name: Create cluster scaleway
|
||||||
community.general.terraform:
|
community.general.terraform:
|
||||||
project_path: '{{ project_terraform }}'
|
project_path: '{{ project_terraform }}'
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
---
|
|
||||||
# tasks file for create cluster k8s via terraform
|
|
||||||
|
|
||||||
- name: Create directory {{ project_terraform }}
|
|
||||||
file:
|
|
||||||
path: "{{ project_backend }}"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: Copy backend k8s yaml
|
|
||||||
template:
|
|
||||||
src: "{{ item }}.yaml.j2"
|
|
||||||
dest: "{{ project_backend }}/{{ item }}.yaml"
|
|
||||||
with_items: "{{ backend_yaml }}"
|
|
||||||
|
|
||||||
- name: Create a k8s namespace
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
name: testing
|
|
||||||
api_version: v1
|
|
||||||
kind: Namespace
|
|
||||||
state: present
|
|
||||||
|
|
||||||
|
|
||||||
- name: Apply deployment
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/backend-deployment.yaml"
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Apply services
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/backend-service.yaml"
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Apply configmap
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/env-configmap.yaml"
|
|
||||||
state: present
|
|
||||||
|
|
||||||
|
|
||||||
- name: Apply secret
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/secret.yaml"
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: En attente d'une adresse IP publique du cluster
|
|
||||||
ansible.builtin.pause:
|
|
||||||
minutes: 2
|
|
||||||
|
|
||||||
- name: Get IP Cluster
|
|
||||||
block:
|
|
||||||
- name: Fetch services
|
|
||||||
set_fact:
|
|
||||||
service: "{{ query('kubernetes.core.k8s', kind='Service', namespace='testing') }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: debug services
|
|
||||||
debug:
|
|
||||||
msg: "{{ result.ansible_facts.service[0].status.loadBalancer.ingress[0].ip }}"
|
|
||||||
|
|
||||||
- name: Test API Backend
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "http://{{ result.ansible_facts.service[0].status.loadBalancer.ingress[0].ip }}:{{ port }}/api/hello"
|
|
||||||
status_code: 200
|
|
||||||
method: GET
|
|
||||||
tags: ["services", "dns"]
|
|
||||||
|
|
||||||
- name: Add DNS for IP Cluster
|
|
||||||
block:
|
|
||||||
- name: Copy script add or update DNS
|
|
||||||
template:
|
|
||||||
src: "dns_add_update.py.j2"
|
|
||||||
dest: "{{ project_backend }}/dns_add_update.py"
|
|
||||||
|
|
||||||
- name: Copy requierements python
|
|
||||||
copy:
|
|
||||||
src: "requierements.txt"
|
|
||||||
dest: "{{ project_backend }}"
|
|
||||||
|
|
||||||
- name: Pip install requierements
|
|
||||||
shell: "pip3.10 install -r {{ project_backend }}/requierements.txt"
|
|
||||||
|
|
||||||
- name: En attente de l'installation des packages
|
|
||||||
ansible.builtin.pause:
|
|
||||||
minutes: 2
|
|
||||||
|
|
||||||
- name: Add or update DNS
|
|
||||||
shell: "python3.10 {{ project_backend }}/dns_add_update.py --ip {{ result.ansible_facts.service[0].status.loadBalancer.ingress[0].ip }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Display result script
|
|
||||||
debug:
|
|
||||||
msg: "{{ result }}"
|
|
||||||
|
|
||||||
- name: Test API Backend with DNS
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "http://api.valczeryba.ovh:{{ port }}/api/hello"
|
|
||||||
status_code: 200
|
|
||||||
method: GET
|
|
||||||
tags: [ "dns" ]
|
|
@ -1,42 +0,0 @@
|
|||||||
---
|
|
||||||
# tasks file for create cluster k8s via terraform
|
|
||||||
|
|
||||||
- name: Apply deployment
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/backend-deployment.yaml"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Apply services
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/backend-service.yaml"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Apply configmap
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/env-configmap.yaml"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
|
|
||||||
- name: Apply secret
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
src: "{{ project_backend }}/secret.yaml"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create a k8s namespace
|
|
||||||
kubernetes.core.k8s:
|
|
||||||
name: testing
|
|
||||||
api_version: v1
|
|
||||||
kind: Namespace
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create directory {{ project_terraform }}
|
|
||||||
file:
|
|
||||||
path: "{{ project_backend }}"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16,10 +16,6 @@
|
|||||||
method: GET
|
method: GET
|
||||||
headers:
|
headers:
|
||||||
X-Auth-Token: "{{ scw_secret_key }}"
|
X-Auth-Token: "{{ scw_secret_key }}"
|
||||||
when: item.name == "{{ project_name_tf }}"
|
when: item.name == "{{ project_name }}"
|
||||||
with_items: "{{ (output.content |from_json).clusters }}"
|
with_items: "{{ (output.content |from_json).clusters }}"
|
||||||
|
|
||||||
- name: Copy kubeconfig
|
|
||||||
copy:
|
|
||||||
src: "{{ project_terraform }}/kubeconfig"
|
|
||||||
dest: "{{ project_kubeconfig }}"
|
|
@ -1,24 +1,15 @@
|
|||||||
- name: Create folder for image
|
- name: Create folder for image
|
||||||
import_tasks: create-build.yml
|
ansible.builtin.import_tasks: create-build.yml
|
||||||
tags: ["create-build"]
|
tags: ["create-build"]
|
||||||
|
|
||||||
- name: Create cluster k8s scaleway via terraform
|
- name: Create cluster k8s scaleway via terraform
|
||||||
import_tasks: create-cluster.yml
|
ansible.builtin.import_tasks: create-cluster.yml
|
||||||
tags: ["create-cluster"]
|
tags: ["create-cluster"]
|
||||||
|
|
||||||
- name: Get id Cluster
|
- name: Get id Cluster
|
||||||
import_tasks: kubeconfig.yml
|
ansible.builtin.import_tasks: kubeconfig.yml
|
||||||
tags: ["create-cluster", "kubeconfig"]
|
tags: ["create-cluster", "kubeconfig"]
|
||||||
|
|
||||||
- name: Deploy a API backend
|
|
||||||
import_tasks: deploy-backend.yml
|
|
||||||
tags: ["deploy"]
|
|
||||||
|
|
||||||
- name: Deploy a API backend
|
|
||||||
import_tasks: destroy-backend.yml
|
|
||||||
tags: ["destroy"]
|
|
||||||
|
|
||||||
|
|
||||||
- name: Destroy cluster k8s scaleway via terraform
|
- name: Destroy cluster k8s scaleway via terraform
|
||||||
import_tasks: destroy-cluster.yml
|
ansible.builtin.import_tasks: destroy-cluster.yml
|
||||||
tags: ["destroy-cluster"]
|
tags: ["destroy-cluster"]
|
@ -1,98 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
annotations:
|
|
||||||
kompose.cmd: kompose convert -f ../docker-compose.yml
|
|
||||||
kompose.version: 1.26.0 (40646f47)
|
|
||||||
creationTimestamp: null
|
|
||||||
labels:
|
|
||||||
io.kompose.service: backend
|
|
||||||
name: backend
|
|
||||||
namespace: testing
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
io.kompose.service: backend
|
|
||||||
strategy: {}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
annotations:
|
|
||||||
kompose.cmd: kompose convert -f ../docker-compose.yml
|
|
||||||
kompose.version: 1.26.0 (40646f47)
|
|
||||||
creationTimestamp: null
|
|
||||||
labels:
|
|
||||||
io.kompose.service: backend
|
|
||||||
spec:
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: regcred
|
|
||||||
containers:
|
|
||||||
- env:
|
|
||||||
- name: POSTGRES_DB
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: POSTGRES_DB
|
|
||||||
name: env
|
|
||||||
- name: POSTGRES_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: POSTGRES_PASSWORD
|
|
||||||
name: env
|
|
||||||
- name: POSTGRES_PORT
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: POSTGRES_PORT
|
|
||||||
name: env
|
|
||||||
- name: POSTGRES_URL
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: POSTGRES_URL
|
|
||||||
name: env
|
|
||||||
- name: POSTGRES_USER
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: POSTGRES_USER
|
|
||||||
name: env
|
|
||||||
- name: REDIS_PORT
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: REDIS_PORT
|
|
||||||
name: env
|
|
||||||
- name: REDIS_URL
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: REDIS_URL
|
|
||||||
name: env
|
|
||||||
- name: MAILER_FROM
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: MAILER_FROM
|
|
||||||
name: env
|
|
||||||
- name: MAILER_HOST
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: MAILER_HOST
|
|
||||||
name: env
|
|
||||||
- name: MAILER_PORT
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: MAILER_PORT
|
|
||||||
name: env
|
|
||||||
- name: MAILER_USERNAME
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: MAILER_USERNAME
|
|
||||||
name: env
|
|
||||||
- name: MAILER_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
key: MAILER_PASSWORD
|
|
||||||
name: env
|
|
||||||
image: rg.fr-par.scw.cloud/covas/quarkus-native
|
|
||||||
name: backend
|
|
||||||
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
resources: {}
|
|
||||||
restartPolicy: Always
|
|
||||||
status: {}
|
|
@ -1,21 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
annotations:
|
|
||||||
kompose.cmd: kompose convert -f ../docker-compose.yml
|
|
||||||
kompose.version: 1.26.0 (40646f47)
|
|
||||||
creationTimestamp: null
|
|
||||||
labels:
|
|
||||||
io.kompose.service: backend
|
|
||||||
name: backend
|
|
||||||
namespace: testing
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- name: "{{ port }}"
|
|
||||||
port: {{ port }}
|
|
||||||
targetPort: {{ targetPort }}
|
|
||||||
type: LoadBalancer
|
|
||||||
selector:
|
|
||||||
io.kompose.service: backend
|
|
||||||
status:
|
|
||||||
loadBalancer: {}
|
|
@ -1,49 +0,0 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
|
||||||
'''
|
|
||||||
First, install the latest release of Python wrapper: $ pip install ovh
|
|
||||||
'''
|
|
||||||
import json
|
|
||||||
import ovh
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('--ip', help='foo help')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
# Instanciate an OVH Client.
|
|
||||||
# You can generate new credentials with full access to your account on
|
|
||||||
# the token creation page
|
|
||||||
client = ovh.Client(
|
|
||||||
endpoint='ovh-eu', # Endpoint of API OVH Europe (List of available endpoints)
|
|
||||||
application_key='{{ application_key }}', # Application Key
|
|
||||||
application_secret='{{ application_secret }}', # Application Secret
|
|
||||||
consumer_key='{{ consumer_key }}', # Consumer Key
|
|
||||||
)
|
|
||||||
|
|
||||||
result = client.get('/domain/zone/valczeryba.ovh/record',
|
|
||||||
fieldType='A',
|
|
||||||
subDomain='api',
|
|
||||||
)
|
|
||||||
|
|
||||||
# Pretty print
|
|
||||||
|
|
||||||
if len(result) > 0:
|
|
||||||
for idDns in result:
|
|
||||||
result = client.get('/domain/zone/valczeryba.ovh/record/{0}'.format(idDns))
|
|
||||||
if result["target"] != args.ip:
|
|
||||||
result = client.put('/domain/zone/valczeryba.ovh/record/{0}'.format(idDns),
|
|
||||||
subDomain='api',
|
|
||||||
target=args.ip,
|
|
||||||
)
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
|
||||||
result = client.post('/domain/zone/valczeryba.ovh/record',
|
|
||||||
fieldType='A',
|
|
||||||
subDomain='api',
|
|
||||||
target=args.ip,
|
|
||||||
ttl=None,
|
|
||||||
)
|
|
||||||
print(result)
|
|
@ -5,10 +5,3 @@ POSTGRES_URL={{ postgres_url }}
|
|||||||
POSTGRES_PORT={{ postgres_port }}
|
POSTGRES_PORT={{ postgres_port }}
|
||||||
REDIS_URL={{ redis_url }}
|
REDIS_URL={{ redis_url }}
|
||||||
REDIS_PORT={{ redis_port }}
|
REDIS_PORT={{ redis_port }}
|
||||||
|
|
||||||
|
|
||||||
MAILER_FROM={{ mailer_from }}
|
|
||||||
MAILER_HOST={{ mailer_host }}
|
|
||||||
MAILER_PORT={{ mailer_port }}
|
|
||||||
MAILER_USERNAME={{ mailer_username }}
|
|
||||||
MAILER_PASSWORD={{ mailer_password }}
|
|
@ -1,22 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
POSTGRES_DB: {{ postgres_db }}
|
|
||||||
POSTGRES_PASSWORD: {{ postgres_password }}
|
|
||||||
POSTGRES_PORT: "{{ postgres_port }}"
|
|
||||||
POSTGRES_URL: {{ postgres_url }}
|
|
||||||
POSTGRES_USER: {{ postgres_user }}
|
|
||||||
REDIS_PORT: "{{ redis_port }}"
|
|
||||||
REDIS_URL: {{ redis_url }}
|
|
||||||
MAILER_FROM: {{ mailer_from }}
|
|
||||||
MAILER_HOST: {{ mailer_host }}
|
|
||||||
MAILER_PORT: "{{ mailer_port }}"
|
|
||||||
MAILER_USERNAME: {{ mailer_username }}
|
|
||||||
MAILER_PASSWORD: {{ mailer_password }}
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
creationTimestamp: null
|
|
||||||
labels:
|
|
||||||
io.kompose.service: backend-env
|
|
||||||
name: env
|
|
||||||
namespace: testing
|
|
||||||
|
|
@ -8,8 +8,8 @@ terraform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
resource "scaleway_k8s_cluster" "{{ project_name_tf }}" {
|
resource "scaleway_k8s_cluster" "{{ project_name }}" {
|
||||||
name = "{{ project_name_tf }}"
|
name = "{{ project_name }}"
|
||||||
version = "1.24.3"
|
version = "1.24.3"
|
||||||
cni = "cilium"
|
cni = "cilium"
|
||||||
project_id = "{{ project_id }}"
|
project_id = "{{ project_id }}"
|
||||||
@ -17,7 +17,7 @@ terraform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "scaleway_k8s_pool" "john" {
|
resource "scaleway_k8s_pool" "john" {
|
||||||
cluster_id = scaleway_k8s_cluster.{{ project_name_tf }}.id
|
cluster_id = scaleway_k8s_cluster.{{ project_name }}.id
|
||||||
name = "john"
|
name = "john"
|
||||||
node_type = "DEV1-M"
|
node_type = "DEV1-M"
|
||||||
size = 1
|
size = 1
|
||||||
@ -26,9 +26,9 @@ terraform {
|
|||||||
resource "null_resource" "kubeconfig" {
|
resource "null_resource" "kubeconfig" {
|
||||||
depends_on = [scaleway_k8s_pool.john] # at least one pool here
|
depends_on = [scaleway_k8s_pool.john] # at least one pool here
|
||||||
triggers = {
|
triggers = {
|
||||||
host = scaleway_k8s_cluster.{{ project_name_tf }}.kubeconfig[0].host
|
host = scaleway_k8s_cluster.{{ project_name }}.kubeconfig[0].host
|
||||||
token = scaleway_k8s_cluster.{{ project_name_tf }}.kubeconfig[0].token
|
token = scaleway_k8s_cluster.{{ project_name }}.kubeconfig[0].token
|
||||||
cluster_ca_certificate = scaleway_k8s_cluster.{{ project_name_tf }}.kubeconfig[0].cluster_ca_certificate
|
cluster_ca_certificate = scaleway_k8s_cluster.{{ project_name }}.kubeconfig[0].cluster_ca_certificate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
.dockerconfigjson: {{ dockerconfigjson }}
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
creationTimestamp: "2022-11-26T19:19:41Z"
|
|
||||||
name: regcred
|
|
||||||
namespace: testing
|
|
||||||
uid: {{ uid_secret }}
|
|
||||||
type: kubernetes.io/dockerconfigjson
|
|
@ -11,20 +11,12 @@ services:
|
|||||||
- PGDATA=/var/lib/postgresql/data/pgdata
|
- PGDATA=/var/lib/postgresql/data/pgdata
|
||||||
ports:
|
ports:
|
||||||
- "54321:5432"
|
- "54321:5432"
|
||||||
|
|
||||||
|
|
||||||
mongo:
|
|
||||||
image: mongo
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
ports:
|
|
||||||
- "28017:27017"
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis/redis-stack-server:latest
|
image: redis/redis-stack-server:latest
|
||||||
ports:
|
ports:
|
||||||
- "63791:6379"
|
- "63791:6379"
|
||||||
{% if covas_liquibase == true %}
|
|
||||||
liquibase:
|
liquibase:
|
||||||
build:
|
build:
|
||||||
context: ./covas-liquibase
|
context: ./covas-liquibase
|
||||||
@ -33,7 +25,6 @@ services:
|
|||||||
- db
|
- db
|
||||||
command:
|
command:
|
||||||
- "update"
|
- "update"
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app-db-data:
|
app-db-data:
|
@ -7,6 +7,5 @@ services:
|
|||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
environment:
|
environment:
|
||||||
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
|
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/data
|
- ./data:/data
|
@ -1,3 +0,0 @@
|
|||||||
- name: debug
|
|
||||||
debug:
|
|
||||||
msg: "coucou {{ msg }}"
|
|
@ -30,6 +30,6 @@
|
|||||||
when: "project_env is defined"
|
when: "project_env is defined"
|
||||||
|
|
||||||
- name: Copy docker compose server file
|
- name: Copy docker compose server file
|
||||||
template:
|
copy:
|
||||||
src: "{{ docker_compose_file }}"
|
src: "{{ docker_compose_file }}"
|
||||||
dest: "{{ project_src }}/docker-compose.yml"
|
dest: "{{ project_src }}/docker-compose.yml"
|
@ -1,24 +1,19 @@
|
|||||||
---
|
---
|
||||||
# tasks file for server
|
# tasks file for server
|
||||||
|
|
||||||
|
|
||||||
- name: Debug role
|
|
||||||
import_tasks: debug.yml
|
|
||||||
tags: ["debug"]
|
|
||||||
|
|
||||||
- name: Deploy services
|
- name: Deploy services
|
||||||
import_tasks: deploy.yml
|
ansible.builtin.import_tasks: deploy.yml
|
||||||
tags: ["configure", "create"]
|
tags: ["deploy", "create"]
|
||||||
|
|
||||||
- name: Start services
|
- name: Start services
|
||||||
import_tasks: start.yml
|
ansible.builtin.import_tasks: start.yml
|
||||||
tags: ["configure", "start"]
|
tags: ["deploy", "start"]
|
||||||
|
|
||||||
|
|
||||||
- name: stop services
|
- name: stop services
|
||||||
import_tasks: stop.yml
|
ansible.builtin.import_tasks: stop.yml
|
||||||
tags: ["deconfigure", "stop"]
|
tags: ["destroy", "stop"]
|
||||||
|
|
||||||
- name: Remove services
|
- name: Remove services
|
||||||
import_tasks: remove.yml
|
ansible.builtin.import_tasks: remove.yml
|
||||||
tags: ["deconfigure"]
|
tags: ["destroy"]
|
@ -15,8 +15,4 @@
|
|||||||
- name: Remove project
|
- name: Remove project
|
||||||
file:
|
file:
|
||||||
path: "{{ project_src }}"
|
path: "{{ project_src }}"
|
||||||
state: absent
|
state: absent
|
||||||
vars:
|
|
||||||
ansible_become: yes
|
|
||||||
ansible_become_method: sudo
|
|
||||||
ansible_become_password: "{{ sudo_password }}"
|
|
@ -1,51 +0,0 @@
|
|||||||
version: '3.5'
|
|
||||||
|
|
||||||
services:
|
|
||||||
drone-server:
|
|
||||||
image: drone/drone:2
|
|
||||||
ports:
|
|
||||||
- 8000:80
|
|
||||||
- 9000:443
|
|
||||||
networks:
|
|
||||||
- drone
|
|
||||||
volumes:
|
|
||||||
- ./drone-data:/var/lib/drone/
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- DRONE_GITHUB_SKIP_VERIFY=true
|
|
||||||
- DRONE_AGENTS_ENABLED=true
|
|
||||||
- DRONE_SERVER_PROTO=http
|
|
||||||
- DRONE_TLS_AUTOCERT=false
|
|
||||||
- DRONE_OPEN=false
|
|
||||||
- DRONE_HOST=http://drone.valczeryba.ovh:8000
|
|
||||||
- DRONE_GITHUB=true
|
|
||||||
# Variables below set via drone.env file
|
|
||||||
# - DRONE_USER_CREATE=
|
|
||||||
# - DRONE_USER_FILTER=
|
|
||||||
# - DRONE_GITHUB_CLIENT_ID=
|
|
||||||
# - DRONE_GITHUB_CLIENT_SECRET=
|
|
||||||
# - DRONE_RPC_SECRET=
|
|
||||||
|
|
||||||
drone-agent:
|
|
||||||
image: drone/agent:1.2.1
|
|
||||||
command: agent
|
|
||||||
restart: always
|
|
||||||
depends_on:
|
|
||||||
- drone-server
|
|
||||||
networks:
|
|
||||||
- drone
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
environment:
|
|
||||||
- DRONE_RPC_SERVER=drone-server:8000
|
|
||||||
# Variables below set via drone.env file
|
|
||||||
# - DRONE_RPC_SECRET=
|
|
||||||
|
|
||||||
networks:
|
|
||||||
drone:
|
|
||||||
name: drone_network
|
|
@ -1,6 +1,3 @@
|
|||||||
POSTGRES_PASSWORD={{ postgres_password }}
|
POSTGRES_PASSWORD={{ postgres_password }}
|
||||||
POSTGRES_USER={{ postgres_user }}
|
POSTGRES_USER={{ postgres_user }}
|
||||||
POSTGRES_DB={{ postgres_db }}
|
POSTGRES_DB={{ postgres_db }}
|
||||||
|
|
||||||
MONGO_INITDB_ROOT_USERNAME={{ mongo_user }}
|
|
||||||
MONGO_INITDB_ROOT_PASSWORD={{ mongo_password }}
|
|
@ -1,8 +0,0 @@
|
|||||||
# Drone secret key, used for private communication between agents and web UI
|
|
||||||
DRONE_USER_CREATE=
|
|
||||||
DRONE_USER_FILTER= {{ drone_user_filter }}
|
|
||||||
DRONE_GITEA_SERVER={{ drone_gitea_server }}
|
|
||||||
DRONE_GITEA_CLIENT_ID={{ drone_gitea_client_id }}
|
|
||||||
DRONE_GITEA_CLIENT_SECRET={{ drone_gitea_client_secret }}
|
|
||||||
DRONE_RPC_SECRET={{ drone_rpc_secret }}
|
|
||||||
DRONE_SERVER_HOST={{ drone_server_host }}
|
|
Loading…
x
Reference in New Issue
Block a user