Skip to content
Snippets Groups Projects
Commit a308f717 authored by elhasnaoui's avatar elhasnaoui
Browse files

Feat: Add CI pipeline to deploy the synapse application

parent 2f06b722
No related branches found
No related tags found
No related merge requests found
Pipeline #42852 failed
stages:
- build
- Config
- deploy
# TInstall the base Configuration.
Configuration_base:
stage: build
script:
- ansible-playbook -i inventory.ini main.yml --ask-vault-pass
# Upgrade packages.
Upgrade:
stage: build
script:
- ansible-playbook -i inventory.ini upgrade.yml --ask-vault-pass
# Configure docker
Configuration_docker:
stage: Config
script:
- ansible-playbook -i inventory.ini Config.yml --ask-vault-pass
# Configure nginx
Configuration_nginx:
stage: Config
script:
- ansible-playbook -i inventory.ini nginx.yml --ask-vault-pass
# Configure postgreSQL
Configuration_postgreSQL:
stage: Config
script:
- ansible-playbook -i inventory.ini postgresql.yml --ask-vault-pass
# Deploy the synapse app.
Configuration_Synapse:
stage: deploy
script:
- ansible-playbook -i inventory.ini synapse.yml --ask-vault-pass
\ No newline at end of file
{
"ansible.python.interpreterPath": "/usr/local/bin/python3"
}
\ No newline at end of file
......@@ -11,7 +11,5 @@ docker_apt_arch: "{{ arch }}"
root_user:
default_root_keys:
- name: thomas-ed25519
key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPrw78OSJACq5MFXHrhAr2bPpnTNxwLE85mzij8gKmCs thomas@thonkpad
- name: g7_key-ed25519
key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFH+M4GLKYVf/hThCQ+DwJXYqEb7THVkfqqnVh32DAOI pifou@zabeth11
key: <Your ed25519 public key>
[all]
# Replace this with your hostname and IP address
172.26.145.114
172.26.145.115
<The IP address of your PostgreSQL Database VM>
<The IP address of your Synapse webserver VM>
[db]
172.26.145.114
<The IP address of your PostgreSQL Database VM>
[synapse]
172.26.145.115
<The IP address of your Synapse webserver VM>
\ No newline at end of file
server {
listen 443 ssl;
server_name synapse.nyala.website;
server_name <Your synapse web server>;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
......@@ -8,8 +8,8 @@ server {
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_certificate /etc/letsencrypt/live/synapse.nyala.website-0001/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/synapse.nyala.website-0001/privkey.pem;
ssl_certificate <Your Certifact SSL>;
ssl_certificate_key <Your private TLS key>;
location / {
proxy_pass http://127.0.0.1:8008;
......
- hosts: all
tasks:
# Install nginx et assurer la dernière version.
- name: ensure nginx is at the latest version
apt: name=nginx state=latest
# Start nginx on the machine
- name: start nginx
service:
name: nginx
state: started
# Push the nginx server configuration file
- name: Upload the file of configuration to the nginx server.
copy:
src: matrix.conf.j2
dest: /etc/nginx/sites-enabled/matrix
# Restart nginx server
- name: Restart nginx server.
service:
name: nginx
state: restarted
---
# Cette playbook c'est pour installer la base de donner PostgreSQL sur la machine db
- name: "Install and configure nginx web server"
hosts: synapse
roles:
- nginx
\ No newline at end of file
......@@ -30,4 +30,4 @@ ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
subprocess-tee==0.4.1
wcmatch==8.5
yamllint==1.35.1
yamllint==1.35.1
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for roles/nginx
---
# handlers file for roles/nginx
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
---
# Install nginx et assurer la dernière version.
- name: ensure nginx is at the latest version
apt: name=nginx state=latest
# Start nginx on the machine
- name: start nginx
service:
name: nginx
state: started
# Push the nginx server configuration file
- name: Upload the file of configuration to the nginx server.
copy:
src: matrix.conf.j2
dest: /etc/nginx/sites-enabled/matrix
# Restart nginx server
- name: Restart nginx server.
service:
name: nginx
tate: restarted
\ No newline at end of file
localhost
---
- hosts: localhost
remote_user: root
roles:
- roles/nginx
---
# vars file for roles/nginx
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment