In this poject I'll show you how I setup my Jira and Confluence instances in a Docker container.
In the first version I'll explain how you can configure Jira in a Docker container starting from the official image and how to setup the database for this. In the next versions I'll show you my personal setup for Jira and Confluence. The database used for this project is SQL Server.
Check bellow all steps.
Jira database configuration
Microsoft SQL Server is the chosed relational database management system used for this project. In order to configure the database from the environment, avoiding the need to do so through the web startup screen, the following variables must be supplied:
ATL_JDBC_URL
- The database URL; this is database-specific.ATL_JDBC_USER
- The database user to connect as.ATL_JDBC_PASSWORD
- The password for the database user.ATL_DB_DRIVER
- The JDBC driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
in our caseATL_DB_TYPE
- The type of database: mssql in our caseATL_DB_SCHEMA_NAME
- The schema name of the database (optionally).
The following docker-compose file spin up a docker continer with a SQL Server used to setup our
database.
How the volumes are the preferred mechanism for persisting data generated by and used by Docker containers,
we will mount 2 volumes: the SQL Server data will be saved in sql-data
volume and
the JIRA-HOME directory data will be saved in jira-data
volume.
version: "3.7" services: sql-server: container_name: sql-server image: mcr.microsoft.com/mssql/server:2017-latest ports: - "1433:1433" environment: ACCEPT_EULA: "Y" SA_PASSWORD: "Password!_first" volumes: - sql-data:/var/opt/mssql/data volumes: jira-data:
Once the SQL Server container is up and running (docker-compose up -d
), for security purposes we need change the SA password.
The SA account is a system administrator on the SQL Server instance that gets created during setup.
After creating your SQL Server container, the SA_PASSWORD environment variable you specified is
discoverable by running echo $SA_PASSWORD
in the container. Change the SA password with the
following command:
docker exec -it sql-server /opt/mssql-tools/bin/sqlcmd \ -S localhost -U SA -P "Password!_first \ -Q 'ALTER LOGIN SA WITH PASSWORD="Password!_new"'
Now we can configure the database for Jira. Open the SQL Server Management Studio and run the next commands:
CREATE DATABASE jiradb GO CREATE LOGIN jiraUser WITH PASSWORD = '[JiraPassword1!]' GO
CREATE USER jiraUser FOR LOGIN jiraUser GO EXEC sp_addrolemember N'db_owner' , N'jiraUser' GO CREATE SCHEMA jiraschema GO
Jira Setup
Now that the database setup is complete, the next step is to add a new service in docker-compose file, which becomes:
version: "3.7" services: sql-server: container_name: sql-server image: mcr.microsoft.com/mssql/server:2017-latest ports: - "1433:1433" environment: ACCEPT_EULA: "Y" SA_PASSWORD: "Password!_first" volumes: - sql-data:/var/opt/mssql/data jira-software: container_name: jira-software image: atlassian/jira-software ports: - "9000:8080" environment: ATL_JDBC_URL: "jdbc:sqlserver://;serverName=sql-server;portNumber=1433;databaseName=jiradb" ATL_JDBC_USER: "jiraUser" ATL_JDBC_PASSWORD: "[JiraPassword1!]" ATL_DB_DRIVER: "com.microsoft.sqlserver.jdbc.SQLServerDriver" ATL_DB_TYPE: "mssql" ATL_DB_SCHEMA_NAME: "jiraschema" volumes: - jira-data:/var/atlassian/application-data/jira volumes: sql-data: jira-data:
The docker-compuse up -d
command will spin up two docker containers, one with SQL Server and the another
one with Jira Software. Jira is now available on http://localhost:9000*.