user_data 2.98 KB
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
1 2
#cloud-config

JOduMonT's avatar
JOduMonT committed
3 4 5
ssh_authorized_keys:
  - "PUT YOUR SSH KEY PUBLIC HERE"

Pierre Ozoux's avatar
Pierre Ozoux committed
6
write_files:
Pierre Ozoux's avatar
Pierre Ozoux committed
7 8 9 10 11 12 13 14 15 16 17
  - path: /etc/ssh/sshd_config
    permissions: 0600
    owner: root:root
    content: |
      # Use most defaults for sshd configuration.
      UsePrivilegeSeparation sandbox
      Subsystem sftp internal-sftp
      PermitRootLogin no
      AllowUsers core
      PasswordAuthentication no
      ChallengeResponseAuthentication no
Pierre Ozoux's avatar
Pierre Ozoux committed
18
  - path: /etc/sysctl.d/libresh.conf
Pierre Ozoux's avatar
Pierre Ozoux committed
19 20
    permissions: 0644
    owner: root
Pierre Ozoux's avatar
Pierre Ozoux committed
21 22 23
    content: |
      fs.aio-max-nr=1048576
      vm.max_map_count=262144
JOduMonT's avatar
JOduMonT committed
24
      vm.overcommit_memory=1
25
      vm.nr_hugepages=0
Pierre Ozoux's avatar
Pierre Ozoux committed
26 27 28 29 30 31 32 33
  - path: /etc/hosts
    permissions: 0644
    owner: root
    content: |
      127.0.0.1 localhost
      255.255.255.255 broadcasthost
      ::1 localhost
  - path: /etc/environment
JOduMonT's avatar
JOduMonT committed
34
    permissions: 0644
Pierre Ozoux's avatar
Pierre Ozoux committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    owner: root
    content: |
      NAMECHEAP_URL="namecheap.com"
      NAMECHEAP_API_USER="pierreo"
      NAMECHEAP_API_KEY=
      IP=`curl -s http://icanhazip.com/`
      FirstName="Pierre"
      LastName="Ozoux"
      Address=""
      PostalCode=""
      Country="Portugal"
      Phone="+351.967184553"
      EmailAddress="pierre@ozoux.net"
      City="Lisbon"
      CountryCode="PT"
      BACKUP_DESTINATION=root@xxxxx:port
      MAIL_USER=
      MAIL_PASS=
      MAIL_HOST=mail.indie.host
      MAIL_PORT=587
coreos:
  update:
    reboot-strategy: off
  units:
    - name: systemd-sysctl.service
      command: restart
    - name: swap.service
      enable: true
      command: start
      content: |
        [Unit]
        Description=Turn on swap
        [Service]
        Type=oneshot
        RemainAfterExit=true
        ExecStartPre=-/bin/bash -euxc ' \
          fallocate -l 8192m /swap &&\
          chmod 600 /swap &&\
          mkswap /swap'
        ExecStart=/sbin/swapon /swap
        ExecStop=/sbin/swapoff /swap
        [Install]
        WantedBy=local.target
    - name: install-compose.service
      command: start
      content: |
        [Unit]
        Description=Install Docker Compose
        [Service]
        Type=oneshot
        RemainAfterExit=true
        ExecStart=-/bin/bash -euxc ' \
          mkdir -p /opt/bin &&\
          url=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r \'.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))\') &&\
          curl -L $url > /opt/bin/docker-compose &&\
          chmod +x /opt/bin/docker-compose'
91
    - name: install-libresh.service
Pierre Ozoux's avatar
Pierre Ozoux committed
92 93 94
      command: start
      content: |
        [Unit]
95
        Description=Install libre.sh
Pierre Ozoux's avatar
Pierre Ozoux committed
96 97 98 99 100 101 102 103
        [Service]
        Type=oneshot
        RemainAfterExit=true
        ExecStart=-/bin/bash -euxc ' \
          git clone https://github.com/indiehosters/libre.sh.git /libre.sh &&\
          mkdir /{data,system} &&\
          mkdir /data/trash &&\
          cp /libre.sh/unit-files/* /etc/systemd/system && systemctl daemon-reload &&\
104 105
          systemctl enable web-net.service &&\
          systemctl start web-net.service &&\
Pierre Ozoux's avatar
Pierre Ozoux committed
106
          cp /libre.sh/utils/* /opt/bin/'