Skip to content

Commit c0525f4

Browse files
committed
Use podamn instead of docker. Closes #9
1 parent b282950 commit c0525f4

File tree

2 files changed

+29
-78
lines changed

2 files changed

+29
-78
lines changed

README.md

+4-54
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# WSL2-setup
2-
Get ready with Windows WSL2 for python development. The setup prepares you for local development with Docker and working in AWS.
2+
Get ready with Windows WSL2 for python development. The setup prepares you for local development with containers (podman) and working in AWS.
33
We mainly work with JetBrains PyCharm Professional, but you can also use this setup if you want to work with VS Code
44

55
The following setup is tested with
66
- Windows 11 Pro ( Version 22H2 )
77
- WSL2 feature enabled
8-
- VS Code 1.77
9-
- PyCharm Professional 2023.1
10-
- Docker Desktop 4.18.0
8+
- VS Code 1.80
9+
- PyCharm Professional 2023.2
1110

1211
If you have other versions than the ones mentioned above, you might encounter different outcomes or run into issues.
1312
In case of any questions or suggestions, please open up an issue here.
@@ -17,8 +16,7 @@ Task that we will accomplish during this setup
1716
- install software packages required for modern python development: [pyenv](https://github.com/pyenv/pyenv)
1817
and [poetry](https://python-poetry.org/docs)
1918
- configure ssh agent to load your certificates automatically
20-
- ensure AWS client is configured and authentication with saml2aws works
21-
- set up a second WSL2 instance with the latest Ubuntu 23.04
19+
- ensure AWS client is installed
2220
- remove a WSL2 instance
2321

2422
If not stated otherwise, all commands will run inside the WSL instance in Linux bash.
@@ -104,13 +102,6 @@ wsl -l -v
104102
wsl -d $WSL2_INSTANCE
105103
```
106104

107-
## Configure AWS CLI and saml2aws
108-
tbd.
109-
110-
In the meantime, please help yourself with
111-
the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) and
112-
[saml2aws](https://github.com/Versent/saml2aws) documentation.
113-
114105
## Global git config
115106
If you have set up a new WSL2 instance, you should create a global git config. The minimum you have to do is set your
116107
username and email address. Please set the placeholders `<your-name>` and `<your-email-address>` in the script with your
@@ -156,47 +147,6 @@ It's required to keep your WSL instance up to date. form time to time you can ac
156147
```shell
157148
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get full-upgrade -y;'
158149
```
159-
160-
## Set up a second distro
161-
inspired by https://cloudbytes.dev/snippets/how-to-install-multiple-instances-of-ubuntu-in-wsl2
162-
and updated to the latest Version of Ubuntu. Run the following commands in a
163-
___PowerShell terminal___
164-
165-
```
166-
Remove-Item alias:curl
167-
mkdir $HOME\wsl2
168-
cd $HOME\Downloads
169-
curl "https://cloud-images.ubuntu.com/wsl/lunar/current/ubuntu-lunar-wsl-amd64-wsl.rootfs.tar.gz" --output ubuntu-23.04-wsl-rootfs.tar.gz
170-
$WSL2_INSTANCE="ubuntu-2304-dev1"
171-
wsl --import $WSL2_INSTANCE $HOME\wsl2\$WSL2_INSTANCE .\ubuntu-23.04-wsl-rootfs.tar.gz
172-
wsl -d $WSL2_INSTANCE
173-
```
174-
175-
The last command started your second WSL2 instance. Now you can create your user, set the password and ensure that
176-
you are automatically logged in.
177-
178-
Please replace `<USERNAME>` with your own username.
179-
180-
```shell
181-
NEW_USER=<USERNAME>
182-
```
183-
```shell
184-
useradd -m -G sudo -s /bin/bash "$NEW_USER"
185-
passwd "$NEW_USER"
186-
```
187-
To ensure your user is login in by default instead of roo, execute the following command in the WSL instance:
188-
```shell
189-
tee /etc/wsl.conf -a <<_EOF
190-
[user]
191-
default=${NEW_USER}
192-
_EOF
193-
```
194-
195-
You need to restart your WSL instance to activate the change.
196-
Once you are successfully logged in, you can proceed with
197-
- Install required linux packages
198-
- SSH config for git
199-
- Configure AWS CLI and saml2aws
200150

201151
## Remove a WSL instance
202152
Removal of a WSL2 instance is straight forward.

wsl_install_software.sh

+25-24
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,41 @@
22
# prepare a fresh WSL Ubuntu distro for development of dockerized python applications
33
# provided by: tuteco GmbH - the data and knowledge experts
44

5+
# define the podman source repository
6+
sudo mkdir -p /etc/apt/keyrings
7+
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key \
8+
| gpg --dearmor \
9+
| sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
10+
echo \
11+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
12+
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
13+
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
14+
515
# update and install required software packages
616
sudo apt-get update \
717
&& sudo apt-get install --no-install-recommends -y \
818
make build-essential libssl-dev zlib1g-dev \
919
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
1020
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
11-
unzip rsync wslu binfmt-support
21+
unzip rsync wslu binfmt-support podman
22+
23+
# enable the systemd socket to ensure docker compatibility
24+
systemctl --user enable podman.socket
25+
systemctl --user start podman.socket
26+
27+
# create symbolc link to enable PyCharm compatibility to access the unix socket
28+
sudo ln -sfvT /run/user/${UID}/podman/podman.sock /var/run/docker.sock
1229

1330
# required software tools directories
1431
mkdir -p .local/bin
1532
mkdir ~/tmp
1633

17-
1834
# aws cli installation
1935
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
2036
unzip awscliv2.zip
2137
sudo ./aws/install
2238
rm awscliv2.zip
2339

24-
# saml2aws installation
25-
CURRENT_VERSION=$(curl -Ls https://api.github.com/repos/Versent/saml2aws/releases/latest | grep 'tag_name' | cut -d'v' -f2 | cut -d'"' -f1)
26-
wget -c https://github.com/Versent/saml2aws/releases/download/v${CURRENT_VERSION}/saml2aws_${CURRENT_VERSION}_linux_amd64.tar.gz -O - | tar -xzv -C ~/.local/bin
27-
chmod u+x ~/.local/bin/saml2aws
28-
hash -r
29-
30-
echo '' >> ~/.profile
31-
echo 'eval "$(saml2aws --completion-script-bash)"' >> ~/.profile
32-
3340
# pyenv installation
3441
rm -rf ~/.pyenv
3542
curl https://pyenv.run | bash
@@ -59,24 +66,18 @@ echo '' >> ~/.bashrc
5966
curl https://raw.githubusercontent.com/tuteco/wsl-setup/main/git_branch_to_brashrc.txt >> ~/.bashrc
6067

6168
# install the desired python versions
62-
# we use 3.10 as default version for productive use
63-
pyenv install 3.11.3
64-
pyenv install 3.10.11
65-
pyenv install 3.9.16
66-
pyenv global 3.10.11
69+
# we use 3.11 as default version for productive use
70+
pyenv install 3.11.4
71+
pyenv install 3.10.12
72+
pyenv global 3.11.4
6773

6874
# install poetry
6975
curl -sSL https://install.python-poetry.org | python3 -
7076

7177
# development directory structure
72-
mkdir -p ~/docker-volumes
73-
mkdir -p ~/workspace
74-
75-
# ensure systemd gets started, so that we can use snap to install software
76-
sudo tee /etc/wsl.conf -a <<_EOF
77-
[boot]
78-
systemd=true
79-
_EOF
78+
mkdir -p ~/workspace/local_pg/db/data
79+
mkdir -p ~/workspace/pump_config
80+
mkdir -p ~/workspace/log
8081

8182
echo '-------------------------------------------------------'
8283
echo 'please restart your WSL2 to activate all changes'

0 commit comments

Comments
 (0)