mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-16 08:12:12 +11:00
docker file and ansible playbook addition
This commit is contained in:
parent
89448a4b12
commit
decfd83931
5 changed files with 112 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
.vscode
|
.vscode
|
||||||
build
|
build
|
||||||
ccash_config.hpp
|
ccash_config.hpp
|
||||||
|
deployment/.yamllint
|
||||||
13
Dockerfile
13
Dockerfile
|
|
@ -1,18 +1,21 @@
|
||||||
FROM alpine:3.11
|
FROM alpine:latest
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
RUN apk update && apk add git cmake g++ make protobuf jsoncpp-dev openssl libressl-dev zlib-dev util-linux-dev libtool autoconf automake python3
|
RUN apk update && apk add bash git cmake g++ make protobuf jsoncpp-dev openssl libressl-dev zlib-dev util-linux-dev libtool autoconf automake python3
|
||||||
|
|
||||||
RUN git clone --recurse-submodules https://github.com/EntireTwix/CCash.git
|
RUN git clone --recurse-submodules https://github.com/EntireTwix/CCash.git
|
||||||
WORKDIR /CCash/third_party/base64/
|
WORKDIR /CCash/third_party/base64/
|
||||||
RUN AVX2_CFLAGS=-mavx2 SSSE3_CFLAGS=-mssse3 SSE41_CFLAGS=-msse4.1 SSE42_CFLAGS=-msse4.2 AVX_CFLAGS=-mavx make lib/libbase64.o
|
RUN AVX2_CFLAGS=-mavx2 SSSE3_CFLAGS=-mssse3 SSE41_CFLAGS=-msse4.1 SSE42_CFLAGS=-msse4.2 AVX_CFLAGS=-mavx make lib/libbase64.o
|
||||||
RUN mkdir /CCash/build
|
RUN mkdir /CCash/build
|
||||||
WORKDIR /CCash/build
|
WORKDIR /CCash/build
|
||||||
RUN cmake -DDROGON_CONFIG_LOC=/CCash/config/config.json -DUSER_SAVE_LOC=/CCash/config/users.dat ..
|
RUN cmake -DDROGON_CONFIG_LOC="/CCash/config/config.json" -DUSER_SAVE_LOC="/CCash/config/users.dat" ..
|
||||||
RUN make -j$(nproc)
|
RUN make -j$(nproc)
|
||||||
|
|
||||||
ARG ADMIN_A=admin
|
ARG ADMIN_A=admin
|
||||||
ARG SAVE_FREQ=2
|
ARG SAVE_FREQ=2
|
||||||
|
WORKDIR /
|
||||||
CMD ["sh", "-c", "/CCash/config/ssl.sh && /CCash/build/bank ${ADMIN_A} ${SAVE_FREQ}"]
|
RUN sed -i 's/\r$//' /CCash/config/ssl.sh && \
|
||||||
|
chmod +x /CCash/config/ssl.sh
|
||||||
|
RUN /CCash/build/bank
|
||||||
|
CMD /CCash/config/ssl.sh && /CCash/build/bank ${ADMIN_A} ${SAVE_FREQ}
|
||||||
2
deployment/inventory
Normal file
2
deployment/inventory
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[all]
|
||||||
|
10.10.0.145 ansible_ssh_user=root ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||||
96
deployment/main.yml
Normal file
96
deployment/main.yml
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
become: true
|
||||||
|
pre_tasks:
|
||||||
|
- name: load variables
|
||||||
|
ansible.builtin.include_vars: '{{ item }}'
|
||||||
|
with_first_found:
|
||||||
|
- "default.yml"
|
||||||
|
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: refresh packages update
|
||||||
|
yum:
|
||||||
|
name: "*"
|
||||||
|
update_cache: true
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: Add repository
|
||||||
|
yum:
|
||||||
|
name: epel-release
|
||||||
|
state: latest
|
||||||
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
|
yum:
|
||||||
|
name: [git, gcc, gcc-c++, libuuid-devel, openssl-devel, zlib-devel, jsoncpp-devel, cmake]
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
|
- name: clone CCash repository
|
||||||
|
git:
|
||||||
|
repo: https://github.com/EntireTwix/CCash.git
|
||||||
|
dest: '{{BUILD_DIR}}/CCash'
|
||||||
|
recursive: true
|
||||||
|
update: false
|
||||||
|
|
||||||
|
- name: Make lib base64
|
||||||
|
community.general.make:
|
||||||
|
chdir: '{{BUILD_DIR}}/CCash/third_party/base64'
|
||||||
|
params:
|
||||||
|
AVX2_CFLAGS: -mavx2
|
||||||
|
SSSE3_CFLAGS: -mssse3
|
||||||
|
SSE41_CFLAGS: -msse4.1
|
||||||
|
SSE42_CFLAGS: -msse4.2
|
||||||
|
AVX_CFLAGS: -mavx
|
||||||
|
|
||||||
|
- name: create build dir
|
||||||
|
file:
|
||||||
|
path: '{{BUILD_DIR}}/CCash/build'
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Cmake CCash
|
||||||
|
ansible.builtin.command:
|
||||||
|
chdir: '{{BUILD_DIR}}/CCash/build'
|
||||||
|
cmd: |
|
||||||
|
cmake -DDROGON_CONFIG_LOC="{{ BUILD_DIR }}/CCash/config/config.json" -DUSER_SAVE_LOC="{{ BUILD_DIR }}/CCash/config/users.dat" ..
|
||||||
|
|
||||||
|
- name: make CCash
|
||||||
|
community.general.make:
|
||||||
|
chdir: '{{BUILD_DIR}}/CCash/build'
|
||||||
|
params:
|
||||||
|
NUM_THREADS: '-j{{ ansible_processor_vcpus }}'
|
||||||
|
|
||||||
|
|
||||||
|
- name: create users file
|
||||||
|
ansible.builtin.command:
|
||||||
|
chdir: '{{BUILD_DIR}}/CCash/build/'
|
||||||
|
cmd: ./bank
|
||||||
|
creates: '{{ BUILD_DIR }}/CCash/config/users.dat'
|
||||||
|
- name: chmod +x ssl.sh
|
||||||
|
ansible.builtin.file:
|
||||||
|
mode: u+x
|
||||||
|
path: '{{BUILD_DIR}}/CCash/config/ssl.sh'
|
||||||
|
- name: generate default ssl
|
||||||
|
ansible.builtin.command:
|
||||||
|
chdir: '{{BUILD_DIR}}/CCash/config/'
|
||||||
|
cmd: './ssl.sh'
|
||||||
|
|
||||||
|
- name: create service file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=CCash API Server
|
||||||
|
After=network.target remote-fs.target nss-lookup.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart={{BUILD_DIR}}/CCash/build/bank {{ADMIN_A}} {{SAVE_FREQ}}
|
||||||
|
ExecStop=/bin/kill -WINCH ${MAINPID}
|
||||||
|
KillSignal=SIGCONT
|
||||||
|
PrivateTmp=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
dest: /etc/systemd/system/ccash.service
|
||||||
4
deployment/vars/default.yml
Normal file
4
deployment/vars/default.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
BUILD_DIR: '/root'
|
||||||
|
ADMIN_A: "admin"
|
||||||
|
SAVE_FREQ: "2"
|
||||||
Loading…
Reference in a new issue