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

Instructions and Docker Support for Running Bamboo Locally #2

Open
mblomdahl opened this issue Sep 12, 2022 · 2 comments
Open

Instructions and Docker Support for Running Bamboo Locally #2

mblomdahl opened this issue Sep 12, 2022 · 2 comments
Assignees

Comments

@mblomdahl
Copy link
Member

mblomdahl commented Sep 12, 2022

We need to be able to run a local Bamboo server with MySQL, in order to have realistic database contents to generate reports from.

Instructions on how to run MySQL server in Docker: https://hub.docker.com/_/mysql

services:
  mysql_server:
    image: mysql/mysql-server:5.7
    container_name: bamboo_mysql
    command: --default-authentication-plugin=mysql_native_password
    ports:
      - target: 3306
        published: 3306
        protocol: tcp
        mode: host
    environment:
      - MYSQL_DATABASE=bamboo
      - MYSQL_USER=bamboo
      - MYSQL_ROOT_PASSWORD=*******
    volumes:
      - bamboo_mysql:/var/lib/mysql:rw

Instructions on how to run Bamboo server in Docker: https://hub.docker.com/r/atlassian/bamboo-server

services:
  bamboo_server:
    image: atlassian/bamboo-server:8.2.5
    container_name: bamboo_server
    depends_on:
      - mysql_server
    ports:
      - target: 8085
        published: 8085
        protocol: tcp
        mode: host
    environment:
      - ATL_PROXY_NAME=mblomdahl-mkdevops-se-bamboo-ci-health-7gwq6wr562p5qw-8085.githubpreview.dev
      - ATL_PROXY_PORT=443
      - ATL_LICENSE=AAA...X02kc
      - ATL_JDBC_URL=jdbc:mysql://bamboo_mysql:3306/bamboo
      - ATL_JDBC_USER=bamboo
      - ATL_JDBC_PASSWORD=********
      - ATL_JDBC_TYPE=mysql
    volumes:
      - bamboo_server:/var/atlassian/application/application-data/bamboo:rw

Example Ansible tasks for downloading MySQL driver:

  # See https://confluence.atlassian.com/bamboo/mysql-289276817.html
- name: download mysql connector
  unarchive:
    src: https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.44.tar.gz
    dest: /tmp
    remote_src: yes
    creates: /tmp/mysql-connector-java-5.1.44
  tags: bamboo

- name: add mysql connector to bamboo install
  shell: cp -v /tmp/mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar
         /opt/atlassian/atlassian-bamboo-latest/lib/
  args:
    creates: /opt/atlassian/atlassian-bamboo-latest/lib/mysql-connector-java-5.1.44-bin.jar
  become: yes
  become_user: bamboo
  tags: bamboo

These should be compiled into a docker-compose.yml that we can run without too much hazzle.

@mblomdahl mblomdahl self-assigned this Sep 12, 2022
mblomdahl added a commit that referenced this issue Sep 12, 2022
After hours and hours of troubleshooting, this is the initial (failing) stab at getting Bamboo to communicate with MySQL 5.7, upon performing the _Setting Up Database_ steps during the basic Bamboo configuration guide, we keep getting these errors in MySQL server:

    2022-09-12T19:02:41.813374Z 5 [Note] Aborted connection 5 to db: 'bamboo' user: 'bamboouser' host: '172.20.0.3' (Got an error reading communication packets)
    2022-09-12T19:02:43.815778Z 6 [Note] Aborted connection 6 to db: 'bamboo' user: 'bamboouser' host: '172.20.0.3' (Got an error reading communication packets)
    ...

This is the error detail at maximum error log verbosity, and Bamboo fails without clear error message and redirects back to the _Configure Database Connection Parameters Form_.

We should proceed with using Postgres as database instead, and see if we can make the Python Pandas abstract away the RDBMS differences.
mblomdahl added a commit that referenced this issue Sep 12, 2022
Initial Bamboo configuration screens must still be filled in with DB parameters and data import options, but apart from this it is up and running upon 'docker-compose up'.
@mblomdahl
Copy link
Member Author

Now up and running, with an initial local agent added:

image

mblomdahl added a commit that referenced this issue Sep 17, 2022
- Secrets added to a `.env.template` that becomes a gitignored `.env` file
- Environment for Bamboo server adjusted to allow for zero-setup environment based deployment
- Dockerfile extended to install basic Linux tools, Python and Node toolboxes, and Ansible + AWS CLI
mblomdahl added a commit that referenced this issue Sep 18, 2022
- More Linux basics, `wget`, `tree`, `jq`, `dnsutils` and `traceroute`
- IPython added for Python development
- Scala and Kotlin added for Java development
- Ruby added for provisioning
mblomdahl added a commit to mkdevops-se/hq.mkdevops.se that referenced this issue Sep 18, 2022
- Virtualhost added for smithmicro/bamboo-ci-health#2 Bamboo server
- Disk partition `/opt` extended to fit Bamboo home located under `/opt/bamboo-ci-health`
- Docker upgraded from version 18 to 20 (required for passing all the `bamboo-ci-health` APT installs during `docker-compose build`)
- Minor version bump to `docker-compose-1.24.1`
mblomdahl added a commit that referenced this issue Sep 18, 2022
Adding the so called "deprecated" `CATALINA_CONNECTOR_...` environment variables leads to server.xml template getting properly populated.

Verified to work: https://bamboo.mkdevops.se
@mblomdahl
Copy link
Member Author

@akebrissman Try it out behind your own Nginx proxy! Sign up at https://bamboo.mkdevops.se and consider Bamboo maybe aint so bad, if it's small and convenient to deploy like this.

mblomdahl added a commit that referenced this issue Sep 24, 2022
- Add "`nginx_proxy`" service to Docker Compose
- Add Nginx config templates per [DockerHub Nginx reference](https://hub.docker.com/_/nginx)
- Add localhost certificates per [Let's Encrypt guide](https://letsencrypt.org/docs/certificates-for-localhost/#making-and-trusting-your-own-certificates)
- Update .env template with new (mandatory) variables `BAMBOO_HOSTNAME` and `BAMBOO_PORT`
mblomdahl added a commit that referenced this issue Sep 24, 2022
- Add "`nginx_proxy`" service to Docker Compose
- Add Nginx config templates per [DockerHub Nginx reference](https://hub.docker.com/_/nginx)
- Add localhost certificates per [Let's Encrypt guide](https://letsencrypt.org/docs/certificates-for-localhost/#making-and-trusting-your-own-certificates)
- Update .env template with new (mandatory) variables `BAMBOO_HOSTNAME` and `BAMBOO_PORT`
mblomdahl added a commit that referenced this issue Sep 25, 2022
Deactivate this useful but vulnerable capability by passing `BAMBOO_HOST_DOCKER_SOCKET=/dev/null` in your environment file.
mblomdahl added a commit that referenced this issue Sep 26, 2022
- Dockerfile updates to map `bamboo` group to host `docker` group
- Custom logo added, pending actual customization
mblomdahl added a commit that referenced this issue Sep 27, 2022
- Move PostgreSQL data storage from Docker volume to disk
- Add disk volume mount for Nginx to serve static files
- Place all Bamboo related Docker volume mounts under `./data/` directory (Bamboo home, PostgreSQL data, Nginx static content)
- Rename generic "nginx_proxy" name to more specific "bamboo_nginx"
- Dedicated health endpoint for Nginx, `/nginx_health`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant