11name : ' Run EE Server'
2- description : ' Run EE server'
2+ description : ' Run EE server. Returns once server is ready. Only tested on Linux and macOS'
3+ # NOTE: do not share this server container with others
4+ # since it's using the default admin / admin credentials
35inputs :
46 # All inputs in composite actions are strings
57 use-server-rc :
68 required : true
7- default : false
9+ description : Deploy server release candidate?
10+ default : ' false'
811 server-tag :
912 required : true
13+ description : Specify Docker tag
14+
1015 default : ' latest'
1116 # Github Composite Actions can't access secrets
1217 # so we need to pass them in as inputs
1318 docker-hub-username :
19+ description : Required for using release candidates
1420 required : false
1521 docker-hub-password :
22+ description : Required for using release candidates
1623 required : false
1724
1825runs :
1926 using : " composite"
2027 steps :
21- - name : Create config folder to store configs in
22- run : mkdir configs
28+ - name : Install crudini to manipulate config.conf
29+ # This will only work on the Github hosted runners.
30+ run : pipx install crudini --pip-args "-c ${{ github.workspace }}/.github/workflows/requirements.txt"
31+ working-directory : .github/workflows
2332 shell : bash
2433
25- - name : Use release server
26- if : ${{ inputs.use-server-rc == 'false' }}
27- run : echo "SERVER_IMAGE=aerospike/aerospike-server-enterprise" >> $GITHUB_ENV
34+ - name : Create config.conf
35+ run : cp config.conf.template config.conf
36+ working-directory : .github/workflows
2837 shell : bash
2938
30- - name : Use release candidate server
31- if : ${{ inputs.use-server-rc == 'true' }}
32- run : echo "SERVER_IMAGE=aerospike/aerospike-server-enterprise-rc" >> $GITHUB_ENV
39+ - name : Use enterprise edition instead of community edition in config.conf
40+ run : |
41+ crudini --existing=param --set config.conf enterprise-edition hosts ''
42+ crudini --existing=param --set config.conf enterprise-edition hosts 127.0.0.1:3000
43+ working-directory : .github/workflows
44+ shell : bash
45+
46+ - run : echo SUPERUSER_NAME_AND_PASSWORD="superuser" >> $GITHUB_ENV
47+ shell : bash
48+
49+ - name : Set credentials in config file
50+ run : |
51+ crudini --existing=param --set config.conf enterprise-edition user ${{ env.SUPERUSER_NAME_AND_PASSWORD }}
52+ crudini --existing=param --set config.conf enterprise-edition password ${{ env.SUPERUSER_NAME_AND_PASSWORD }}
53+ working-directory : .github/workflows
3354 shell : bash
3455
3556 - name : Log into Docker Hub to get server RC
3657 if : ${{ inputs.use-server-rc == 'true' }}
3758 run : docker login --username ${{ inputs.docker-hub-username }} --password ${{ inputs.docker-hub-password }}
3859 shell : bash
3960
40- - name : Get default aerospike.conf from Docker server EE container
41- run : |
42- docker run -d --name aerospike -p 3000-3002:3000-3002 $SERVER_IMAGE:${{ inputs.server-tag }}
43- sleep 5
44- docker cp aerospike:/etc/aerospike/aerospike.conf ./configs/aerospike.conf
45- docker container stop aerospike
46- docker container rm aerospike
61+ - run : echo IMAGE_NAME=aerospike/aerospike-server-enterprise${{ inputs.use-server-rc == 'true' && '-rc' || '' }}:${{ inputs.server-tag }} >> $GITHUB_ENV
62+ shell : bash
63+
64+ - run : echo NEW_IMAGE_NAME=${{ env.IMAGE_NAME }}-security-and-sc >> $GITHUB_ENV
65+ shell : bash
66+
67+ # macOS Github runners and Windows self-hosted runners don't have buildx installed by default
68+ - if : ${{ runner.os == 'Windows' || runner.os == 'macOS' }}
69+ uses : docker/setup-buildx-action@v3
70+
71+ - name : Build and push
72+ uses : docker/build-push-action@v6
73+ with :
74+ # Don't want to use default Git context or else it will clone the whole Python client repo again
75+ context : .github/workflows/docker-build-context
76+ build-args : |
77+ server_image=${{ env.IMAGE_NAME }}
78+ tags : ${{ env.NEW_IMAGE_NAME }}
79+ # setup-buildx-action configures Docker to use the docker-container build driver
80+ # This driver doesn't publish an image locally by default
81+ # so we have to manually enable it
82+ load : true
83+
84+ - run : echo SERVER_CONTAINER_NAME="aerospike" >> $GITHUB_ENV
85+ shell : bash
86+
87+ - run : docker run -d --name ${{ env.SERVER_CONTAINER_NAME }} -e DEFAULT_TTL=2592000 -p 3000:3000 ${{ env.NEW_IMAGE_NAME }}
88+ shell : bash
89+
90+ - uses : ./.github/actions/wait-for-as-server-to-start
91+ with :
92+ container-name : ${{ env.SERVER_CONTAINER_NAME }}
93+ is-strong-consistency-enabled : true
94+
95+ - run : echo ASADM_AUTH_FLAGS="--user=${{ env.SUPERUSER_NAME_AND_PASSWORD }} --password=${{ env.SUPERUSER_NAME_AND_PASSWORD }}" >> $GITHUB_ENV
4796 shell : bash
4897
49- - name : Enable security features using aerospike.conf
50- # Security stanza
51- run : echo -e "security {\n\tenable-quotas true\n}\n" >> ./aerospike.conf
52- working-directory : ./configs
98+ # All the partitions are assumed to be dead when reusing a roster file
99+ - run : docker exec ${{ env.SERVER_CONTAINER_NAME }} asadm $ASADM_AUTH_FLAGS --enable --execute "manage revive ns test"
53100 shell : bash
54101
55- - name : Run enterprise edition server
56- run : docker run -tid -v $(pwd)/configs:/opt/aerospike/etc -p 3000:3000 --name aerospike $SERVER_IMAGE:$ {{ inputs.server-tag }} asd --config-file /opt/aerospike/etc/aerospike.conf
102+ # Apply changes
103+ - run : docker exec $ {{ env.SERVER_CONTAINER_NAME }} asadm $ASADM_AUTH_FLAGS --enable --execute "manage recluster"
57104 shell : bash
58105
59- - name : Create user in database for tests
60- # Use default admin user to create another user for testing
61- run : docker exec aerospike asadm --user admin --password admin --enable -e "manage acl create user superuser password superuser roles read-write-udf sys-admin user-admin data-admin"
106+ # For debugging
107+ - run : docker logs aerospike
62108 shell : bash
0 commit comments